admin管理员组

文章数量:1355643

I'm trying to follow the examples found here that explain how to use Xrm.Navigation.openForm method to open a CRM form for a new entity.

My target entity has multiple forms and I'm trying to specify the form ID in the entityFormOptions object as described in the link above. I've copied the relevant text here (with the relevant line in bold):

entityFormOptions

Entity form options for opening the form. The object contains the following attributes:

  • cmdbar: (Optional) Boolean. Indicates whether to display the mand bar. If you do not specify this parameter, the mand bar is displayed by default.
  • createFromEntity: (Optional) Lookup. Designates a record that will provide default values based on mapped attribute values. The lookup object has the following String properties: entityType, id, and name (optional).
  • entityId: (Optional) String. ID of the entity record to display the form for.
  • entityName: (Optional) String. Logical name of the entity to display the form for.
  • formId: (Optional) String. ID of the form instance to be displayed.
  • height: (Optional) Number. Height of the form window to be displayed in pixels.
  • navBar: (Optional) String. Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the sitemap. Valid values are: "on", "off", or "entity".

However this doesn't seem to work for me. The ID of my form is 375DE297-C0AF-4711-A811-5F1663FAE5DA

Here's my code:

var entityFormOptions = {};
entityFormOptions["entityName"] = "contact";
entityFormOptions["formId"] = "375DE297-C0AF-4711-A811-5F1663FAE5DA";
Xrm.Navigation.openForm(entityFormOptions);

The new entity form opens; however it uses the default form, not the specified form.

I am running as a System Administrator and I have confirmed that I have access to all the forms for the specified entity so I don't think it is a form-security issue.

Has anyone tried this method of opening forms in Dynamics 365?

I'm trying to follow the examples found here that explain how to use Xrm.Navigation.openForm method to open a CRM form for a new entity.

My target entity has multiple forms and I'm trying to specify the form ID in the entityFormOptions object as described in the link above. I've copied the relevant text here (with the relevant line in bold):

entityFormOptions

Entity form options for opening the form. The object contains the following attributes:

  • cmdbar: (Optional) Boolean. Indicates whether to display the mand bar. If you do not specify this parameter, the mand bar is displayed by default.
  • createFromEntity: (Optional) Lookup. Designates a record that will provide default values based on mapped attribute values. The lookup object has the following String properties: entityType, id, and name (optional).
  • entityId: (Optional) String. ID of the entity record to display the form for.
  • entityName: (Optional) String. Logical name of the entity to display the form for.
  • formId: (Optional) String. ID of the form instance to be displayed.
  • height: (Optional) Number. Height of the form window to be displayed in pixels.
  • navBar: (Optional) String. Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the sitemap. Valid values are: "on", "off", or "entity".

However this doesn't seem to work for me. The ID of my form is 375DE297-C0AF-4711-A811-5F1663FAE5DA

Here's my code:

var entityFormOptions = {};
entityFormOptions["entityName"] = "contact";
entityFormOptions["formId"] = "375DE297-C0AF-4711-A811-5F1663FAE5DA";
Xrm.Navigation.openForm(entityFormOptions);

The new entity form opens; however it uses the default form, not the specified form.

I am running as a System Administrator and I have confirmed that I have access to all the forms for the specified entity so I don't think it is a form-security issue.

Has anyone tried this method of opening forms in Dynamics 365?

Share Improve this question asked Mar 19, 2018 at 9:15 jasonscriptjasonscript 6,1783 gold badges30 silver badges45 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

This may be a little late but hopefully will help someone else.

The documentation is correct. You can supply formId as shown. You only need to make sure that form is added to the Model Driven App in App Designer (You add the form by checking it on the panel on the right)

var pageInput = {
    pageType: "entityrecord",
    entityName:"icon_case",
    entityId: recordId,
    formId: v_formId
    };

That's looks like mistake in docs or bug in Dynamics.

Previous implementation (v8 and before) took formid in parameters object: https://msdn.microsoft./en-us/library/jj602956.aspx#openEntityForm

Although current documentation states that formId must be set in entityFormOptions it isn't actually honoured. But it is honoured when you put it to good old formParameters.

Thus this does the trick:

var entityFormOptions = {};
entityFormOptions["entityName"] = "contact";
var formParameters = {};
formParameters ["formid"] = "375DE297-C0AF-4711-A811-5F1663FAE5DA";
Xrm.Navigation.openForm(entityFormOptions, formParameters);

P.S. Note that lowercase "formid".

we can also use the below code to open a particular entity form:

var entityFormOptions = {};
entityFormOptions["entityName"] = "nrw_contact";//Logical name of the entity
entityFormOptions["entityId"] = "nrw_contact_ID"; //ID of the entity record
entityFormOptions["formId"] = "CF8D885B-256D-43E6-8776-CBBB7AA88EF5"; //FormId
Xrm.Navigation.openForm(entityFormOptions);

Please refer this link for more details : https://learn.microsoft./en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation/openform

本文标签: javascriptXrmNavigationopenForm not honouring formidStack Overflow