No matter how configurable a product is, we always wish there was a way to run our "own" custom logic.
Ability to execute custom logic on mobile devices even when offline is a major game changer. This could be used to perform data validations, data manipulations based on business requirements.
To start with (Phase1), ServiceMax will support this on change event of "DateTime" field, Before / After Save events, Button click events on SFMs. The custom snippets will be configurable on SFM page layout. Some use-cases this will address are to validate overlapping time / labor entries (See , ) , check for duplicate records using custom logic etc.
We plan to extend this ability to perform data manipulations in Phase2.
If you have more use-cases, we'd love to hear them !
1. Yes the logic will be a custom one. In the snippet, it will be possible to provide the object and fields on which the logic has to be run, conditions (DB query like) under which the snippet should be run, response structures, message to be displayed.
2. The object will be one of the configurable entity in the snippet.
3. I'll update this thread in a week or so with sample snippet
4. Phase1 is 19.1 . Phase2 is likely 19.2
Will the snippet give us access to any of the visual component. For eg. hiding a section/fields of the SFM based on the data? If not, is that a plan to change/add visual components of the SFM through JS?
A use case I would like to be able to do is include field contents within a warning / error message during validation. e.g. If i have a field called Pre Start Notes and I want to confirm the technician has read them I'd like to show a warning message. Currently this message reads 'This Work Order has Pre Start Notes, Please confirm you have read them'. But we would like to show the actual notes within the warning.
More on the snippets that we will enable in 19.1 for FSA -
Below APIs will be exposed, that you can use in the snippets.
Structure of every API, configuration details and a sample snippet will be included in 19.1 documentation. Here is a quick preview.
Here, "query_object" will have to be provided with information required to build a SQL query like object, fields, filter condition, advanced expression, sort order. This SQL query would eventually be executed on the client DB.
See screenshots for the UI feedback that would come from $response. To proceed further, user will have to correct the data or discard the record itself.
@archana_krishna we have issue with look-up field using $event.
console.log('in snippet: event response = ', rec.currentRec);
var parsedRec = JSON.parse(rec);
var FSRName = parsedRec.currentRec['SVMXC__Group_Member__c'];
The above code is returning [object Object]. We couldn't get the look-up value selected by user on SFM to validate. We get all other fields like Date, Boolean, Free text can be access through $event but lookup fields. Do you have any fix for it?
To get the value in the lookup field -
var FSRName = parsedRec.currentRec['SVMXC__Group_Member__c'].value;
To get the SFID in the lookup field -
var FSRName = parsedRec.currentRec['SVMXC__Group_Member__c'].key;
Thank you for your feedback on this topic. I am going to close this discussion and start a new thread on what's new on this topic. Stay tuned!!