All scripts need to consider where they are executed. Create and Validate scripts are executed on the server. This means that a screen in the mobile device when it submits data will see that data processed in the same way as a screen in the main desktop theme.
Note: The mobile screens will use different metadata screens to the main interface screens. For example in the main desktop theme when submitting an opportunity the screens used are
But the mobile screen only uses
You can see in the above lists of metadata screen that the OpportunityDetailBox is the only screen that is used in both the mobile and desktop themes. But the version of the OpportunityDetailBox for the mobile theme includes many more fields than the version of the same screen in the Desktop theme.
We can expect the Create scripts and the Validate scripts for the mobile theme because they are executed on the server to work. And they do.
Note: Create scripts and the Validate scripts do work in the Mobile Theme with the following warnings. Create scripts are focussed on changing the properties of fields such as the Caption or the DefaultValue. This assumes that these make sense within the context of the mobile theme as certain field types are rendered differently in the mobile theme as they are within the desktop theme. An example of is the Search Select Advanced fields where you can set a field's restrictors. This is a property that restricts the searched values for the current Search Select Advanced field.
But this can't be used in the mobile theme (because of the way the theme renders the screen) so instead, we have to make may changes to the file "ssarestrictors.js" here: C:\Program Files (x86)\Sage\CRM\CRM\WWWRoot\tablet\ssa
How to do that will need to be the subject of another article.
Now we can turn our attention to the Client Side scripting.
There are a number of points to realise here:
- The Mobile theme simplifies the interface. See: https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2018/09/06/how-the-mobile-theme-interface-is-generated.aspx
- This simplification includes such things as the Custom Content boxes of the screens being ignored. Custom Content is a very useful feature used frequently in customizations that use Client Side coding in the Desktop Theme. But it can not be used here.
- The libraries used are different. For example the JQuery files included in the Mobile interface are the Mobile versions. The Client Side API used in the Desktop Theme is not referenced. Neither are any fields that you may add into the location C:\Program Files (x86)\Sage\CRM\[installname]\WWWRoot\js\custom
- The fields are rendered differently in HTML. The Mobile Theme does not use the same element naming (in HTML) or ID system as the Desktop Theme.