Scenario Overview
In this scenario, we want to use some of North52s functionality with a custom JavaScript we have.
Using the North52 formula ExecuteCustomJSFunction , we can call upon any Custom JavaScript functions that have been loaded to the Form.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this:
- A formula of type Clientside - Perform Action' is created on the Account entity
- This Formula will be triggered whenever an Account is loaded using the default Account Form.
- The formula will execute the custom JavaScript function.
- This Function will show a Form Notification.
- It will also use Findvalue to grab the Accounts associated Contact description Field and show it in the Form Notificaiton.
Custom JavaScript steps
Note 1 : If you already have your own custom JavaScript, you may wish to skip this step.
For this example , we will create a simple custom JavaScript that will set a Form Notification whenever the default Account form is loaded.
- Open up the CRM solution you are working in.
- Under Components , click New > Web Resource.
- Under Name , enter "LoadJSonAccountForm"
- Under Display Name , enter "LoadJSonAccountForm"
- Under Type, select Script(JScript)
- A Text Editor button should appear, click on it.
- Copy and paste the JavaScript Functions below.
- Click Ok.
- Click Save and Publish.
JavaScript Functions.
if (MyNamespace === undefined) {
var MyNamespace = {};
}
MyNamespace.onLoadShowDescription = function(parm_one){
Xrm.Page.ui.setFormNotification("The Description field from the primary contact : " +
parm_one ,"INFORMATION","3");
}
Add JavaScript to Form
- Open up the Account Form editor
- Under Home , click on Form Properties.
- Under Event List > Form Libraries, click Add.
- Use Search to find your JavaScript.
- Click Add
- Click Ok , save and Publish.
North52 Decision Suite Steps
- Create a new formula of type Clientside - Perform Action'
- Set the Mode to 'Client Side'
- Set Event to 'Create & Update'
- Set Source Entity as 'Account'
- Set Source Property to ***Account Events *** > 'OnLoad'
- Click into the Formula Editor canvas
- Copy and paste the formula below into the Formula Editor
- Click Save
Formula
ExecuteCustomJSFunction('MyNamespace.onLoadShowDescription',
FindValue('contact',
'contactid',
[account.primarycontactid],
'description',
'Not Found')
)