Adding a Dispatch Technician Action to Salesforce Custom Actions
On Salesforce Custom Actions pages, you can add a Dispatch Technician action that users can invoke to open the corresponding Job record on Service Board in a new window.
To add a Dispatch Technician action to Salesforce Custom Actions:
1. On the Salesforce Setup page, in the left pane, in the Platform Tools section, under the Custom Code node, click Visualforce Pages.
2. On the Visualforce Pages page, click New, and then complete the fields as follows:
Field
|
Value
|
Label
|
Dispatch Technician
|
Name
|
Dispatch_Technician
|
Description
|
Dispatch Technician on Service Board
|
Available for Lightning Experience, Lightning Communities, and the mobile app check box
|
Selected
|
Require CSRF protection on GET requests check box
|
Cleared
|
3. In the Visualforce Markup tab, implement the following code, and then click Save.
<apex:page standardController="SVMXC__Service_Order__c">
<script>
var url = "<sb_hostname>/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c }";
window.open(url, 'ServiceBoard', 'resizable=1,status=0,toolbar=0,menubar=0,scrollbars=1')
</script>
</apex:page>
4. Optionally, do any of the following:
◦ To automatically select a Resource List that includes specific fields in Work Order records when users click to open Service Board, use the matchResourceListBy URL parameter.
For example, to auto-select a Resource List that includes records with the Service Team field value, specify:
<sb_hostname>/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c}&matchResourceListBy={!SVMXC__Service_Order__c.SVMXC__Service_Group__c}
◦ To automatically select a Resource List that includes records with non-null Primary Territory field values, or otherwise auto-select a list that includes records with the Service Team field value, specify:
https://myserviceboard.eu.servicemax.io/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c}&matchResourceListBy={!IF( ISBLANK( SVMXC__Service_Order__c.SVMXC__Primary_Territory__c ) , SVMXC__Service_Order__c.SVMXC__Service_Group__c, SVMXC__Service_Order__c.SVMXC__Primary_Territory__c )}
◦ To automatically select a Resource List that includes records with other field values such as custom fields, you can specify full field identifiers in the matchResourceListField URL parameter.
For example, you can create a custom field with the identifier dev_match_field and auto-select a Resource List that includes the field as follows:
https://myserviceboard.eu.servicemax.io/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c}&matchResourceListBy={!SVMXC__Service_Order__c.SVMXC__Service_Group__c}&matchResourceListField=dev_match_field
|
• Only the Name field or the field specified in matchResourceListField that contains the matchResourceListBy value are used for auto-selection.
• The first Resource List that meets the specified selection criteria is shown.
• If no Resource List that meets specified selection criteria is found, the default Resource List appears.
• The matchResourceListField parameter supports only the String data type.
|
◦ To automatically invoke the Propose Times option when users click Dispatch Technician, include the action=triggerProposeTime parameter to the URL with its value set to true or left unspecified. To disable this functionality later on, remove the flag or set its value to false.
https://myserviceboard.eu.servicemax.io/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c}&matchResourceListBy={!SVMXC__Service_Order__c.SVMXC__Service_Group__c}&triggerProposeTime
|
• If you previously specified the triggerProposeTime flag in the URL to automatically invoke the Propose Times option, it is recommended to update the configuration to use the action=triggerProposeTime URL parameter is recommended, but this is optional. Before you apply the action=triggerProposeTime parameterm, sure to disable the triggerProposeTime flag.
• The Propose Times option cannot be automatically invoked if the currently selected Resource List is empty or if the related Job does not appear in the currently selected Job List in Service Board.
• To allow users to select an optimization setting policy, enable the Enable Appointment Proposals Policies Selection setting.
• The action URL parameter has a higher priority than that of the triggerProposeTime flag. If the action parameter is not specified, the triggerProposeTime flag takes effect.
|
◦ To automatically invoke the Resource Recommendations option when users click Dispatch Technician, include the action=resourceRecommendation parameter to the URL:
https://myserviceboard.eu.servicemax.io/sb/index.html#/scheduler/svmx_job?_providerId=salesforce&id={!SVMXC__Service_Order__c.Work_Order_ID_18_digits__c}&action=resourceRecommendation
5. In the left pane, in the Platform Tools section, under the Objects and Fields subnode, click Object Manager, and then on the Custom Objects page, in the list view, click to edit the Work Order object.
6. On the Work Order object page, in the left pane, click Buttons, Links, and Actions, and then click New Action, and then in the top right corner, click New Action.
7. On the Work Order Actions page, complete the fields as follows, and then click Save.
Field | Value |
---|
Action Type | Custom Visualforce |
Visualforce Page | Dispatch Technician |
Height | 250px |
Standard Label Type | None |
Label | Dispatch Technician |
Name | Auto-populates based on Label value. |
Description | Brief description, for example, Dispatch Technician on Service Board. |
8. On the Work Order object page, in the left pane, click Page Layouts, and then in the list view, click to edit the page layout to which you want to add the action, for example, Work Order - Admin.
9. On the Edit Page Layout page, add the action to the layout, and then save your changes.
For more information: