[Quick Tip] How to Apply Javascript On Business Process Fields

In Dynamics CRM 2013 having control on Business Process fields seems to be impossible. You cannot apply Business Rules on these fields but yet it’s possible to access them via Javascript. I think this can be very useful since it’s very simple to implement. You only have to prefix your field names in the code by header_process_ and let the script execute onLoad and onSave.

For example:

  • Getting field’s control when it’s on the form : Xrm.Page.getControl(“fieldname”);
  • Getting field’s control when it’s on the business process: Xrm.Page.getControl(“header_process_fieldname”);

In the business process suppose you want to update the text field field2 when the value of the boolean field1 is Yes:

function iSaidYes()

{

//Check the control on the form

if (Xrm.Page.getControl(“header_process_field1”) != null && Xrm.Page.getControl(“header_process_field2”) != null ) {

if(Xrm.Page.getControl(“header_process_field1”).getAttribute().getValue()==1)

{

Xrm.Page.getControl(“header_process_field2”).getAttribute().setValue(“I said Yes”);

}

else

{
Xrm.Page.getControl(“header_process_field2”).getAttribute().setValue(“I said No”);

}

}

}

 

 

 

 

 

Advertisements

[Quick Tip] Personal Options

Personal Options are that settings applied to the current users.  Open the settings menu at the right of the navigation menu where you can easily set several options like the time zone you are in,  default pane, records per page, default currency, etc…

nav bar

Now click Options, you’ll get the following screen where you can set your Personal Options:

tab