dynamics crm 2011 - Write the plugin when Selecting the lookup flied and according to filed selection Show/Hide Address filed in form.....? -


We have contact entity contact entity, the company name has been entered in a lookup, two values ​​are 1 in that lookup. ACC and 2. Contacts When we are selecting a contact, enter the address that when we locate the account, entering the address, it has been found that we have to write the plugin to do this work.

First of all, if you want to make a change on a form If you need to, you can not use plug-ins. Plug-ins are made for the arguments of the busines, such as updating another record created for the first time, creating complex arguments, etc ...

What you need is a JavaScript that is used on the form of Onload Is implemented on and the exchange event on that option set.

The rows you are looking for are:

  function is available on the showfield () {// field form so we can access it for its option Var optionset = Xrm.Page.getAttribute ("custom_attribute"); If (optionSet == undefined) {return; } // exists on the control form so we can access its methods var controlAddress = Xrm.Page.getControl ("custom_address"); If (controlAddress == undefined) {return; } Var valueOptionSet = optionSet.getValue (); // This is the option that you make the OptionSat switch (Value Option Set) {Case 0: // Show your account value, controlAddress.setVisible (true); Case 1: // Your contact price, to hide the control. The attic.Service (false); Default: Return; }}  

If you need more information about the code or why this stuff is here and why it does not just tell me, you register the web resource and register the event need to.


Comments