Tip – Call JavaScript on change of the field on Form in Resco

By | May 10, 2017

Introduction:

Resco Mobile App is a boon for the Field Technicians; it’s crisp, it’s smooth and has a lot of functionalities that could ease the life of a Technician. Resco provides us Form Rules to perform many things in the face of onchange, onload and onsave event on the form.

Limitations:

We could say, Resco Form Rules are more than sufficient for your core and advanced needs.

But, there could be scenarios that are not simple to implement and cannot leverage the OOB Form Rules functionality.

Workaround:

To leverage the OOB Form Rules functionality, we need to resort to the JavaScript option.

Yes, we can have a JavaScript called/triggered on the change of a field on the Form.

The procedure to implement the JavaScript way is very simple, given that you know how to do that.

Even when we had to implement the JavaScript approach, it took us a while before we could figure out the correct approach.

The steps are pretty simple, as explained below:

1. We need to create an HTML that would be placed as an iframe on the form.

2. The HTML should have a reference to the JSBRIDGE.js

3. Then based on the onchange event described here, create a function.

4. Next, you need to call this function on load of the HTML page; this is the most important step.

We initially tried using the $(document).ready, but it didn’t work.

But, after calling the function as below did the trick for us.

<body onload=”onLoad();”>

5. Once you have the HTML ready, upload the necessary files to the Offline HTML section of Resco, and on the form create an iframe.

Call JavaScript on change of the field on Form in Resco

6. While creating an iframe, do not forget to uncheck the Delay Load.

Call JavaScript on change of the field on Form in Resco

Note: Unchecking the Delay Load makes sure that the HTML is loaded as soon as the form is loaded and hence it facilitates the binding of onchange event.

Conclusion:

Within few simple steps, you can easily have a JavaScript called/triggered on the change of a field on the Form in Resco and leverage the OOB Form Rules functionality.

Export and Email Dynamics 365 Reports in PDF, Word & Excel format with Click2Export