Search code examples
dynamics-crmdynamics-crm-4crmdynamics-crm-2011

Is it possible to put a field in a CRM form without an attribute associated with the field?


I need to simply display a url that's created by some javascript in the forms onload event. I never actually save it to the attribute. Is there a way I can cut out the attribute and just have a blank field in my form that I can write a string too?

Typically I would do something like this:

        var cm_name = new xrm5.Metadata.StringAttributeMetadata()
        {
            Description = CrmHelpers.CreateLocalizedLabel("landingpage_name_description", cultures),
            DisplayName = CrmHelpers.CreateLocalizedLabel("landingpage_name_displayname", cultures),
            Format = xrm5.Metadata.StringFormat.Text,
            IsValidForAdvancedFind = new xrm5.BooleanManagedProperty(true),
            MaxLength = 250,
            RequiredLevel = new xrm5.Metadata.AttributeRequiredLevelManagedProperty(xrm5.Metadata.AttributeRequiredLevel.ApplicationRequired),
            SchemaName = "cm_name"
        };
        cm_name.SetPrivatePropertyValue<bool>("IsPrimaryName", true);
        entityDefinition.Attributes.Add(cm_name);

and

            leftCell = Version4FormGenerator.CreateFormCell(formXmlDom, true, 0, 1, 1, "landingpage_name_displayname", cultures, "cm_name", CLASSID_TEXT_BOX, "cm_name", false, null);

for version 4 and

            leftCell = Version5FormGenerator.CreateFormCell(formXmlDom, true, 0, 1, 1, "landingpage_name_displayname", cultures, "cm_name", CLASSID_TEXT_BOX, "cm_name", false, false, null, new Guid("392b0a44-9c6e-4dba-a5a3-099e1a4b79bf"));

for 2011.

I want to cut the first part out and only have the last two. Is that even possible? This needs to work for both 2011 and ver 4.


Solution

  • Easiest way I think would be to add an IFrame to the form with a custom HTML page, then write the value to that. In 2011 it's easier with web resources, but in 4.0 you could host it in the ISV folder.