3
votes

We currently design our solutions using a single form per entity. We have a current set of requirements where the 10 or so entities are similar in terms of functionality and data collection. Ideally we would like to have entity with 10 or so forms and dependent on a lookup value display the correct form on the click of a custom button.

I have previously worked with a supplier who implemented something like this displaying the correct form using the GUID (using the formid querystring parameter) on the load event using JavaScript. Although this worked 95% of the time, depending on the client machine it occassionally did not load the correct form due to timing issues i.e. the code had not properly executed by the time the form loaded.

Is there a best practice for using this kind of technique?

I guess my other options are 1) multiple entities 2) one form with tabs/sections that i show/hide on the form load

I am leaning towards implementing option 2)

Richard

2
Did you know that the CRM 2011 custom forms are role based, would that help in your case?SarjanWebDev

2 Answers

3
votes

The multiple forms inside of CRM 2011 is only for different roles. It is not designed to handle switching between forms based on entity attributes.

  • Granted what you are trying to do is possible, but you will encounter issues and will need JavaScript to switch the user to the right form type. You'll also cause the user to load the form twice each time (kind of ugly)

  • Another option is to use JavaScript to show/hide the proper elements on the form (similar to 4.0)

  • Or you can just use multiple entities with a common JS file for any kind of logic.

0
votes

depending upon any field value you can switch the forms through JavaScript.

In JavaScript redirect page to url:

[serverurl]/main.aspx?etn=[entityname]&extraqs=etc%3d[entitytypecode]%26formid%3d[formguid]%26id%3d%257b[recordguid]%257d&pagetype=entityrecord

Where

entityname = entity name (e.g. incident),

entitytypecode=entity type code (e.g for incident it is 112),

formguid=guid of the form to which you want to redirect,

recordguid = guid of the record. If you skip id parameter, form will open in create mode.