Change Appointment Candidates
Create a page in your app where you can show the available service resources based on the service territory.
This sample REST API call uses the query request to retrieve the alternate resources.
- Resource URI
-
https://yourInstance.salesforce.com/services/data/vXX.X/query/?q=SELECT+EffectiveStartDate,EffectiveEndDate,ServiceResourceId,ServiceTerritoryId+FROM+ServiceTerritoryMember
-
- Sample Response
-
The API returns the available time slots and service resources.
{ "totalSize" : 55, "done" : true, "records" : [ { "attributes" : { "type" : "ServiceTerritoryMember", "url" : "/services/data/v53.0/sobjects/ServiceTerritoryMember/0HuB0000000TalUKAS" }, "EffectiveStartDate" : "2021-10-22T15:00:00.000+0000", "EffectiveEndDate" : null, "ServiceResourceId" : "0HnB0000000TbgFKAS", "ServiceTerritoryId" : "0HhB0000000TakhKACC" }, { "attributes" : { "type" : "ServiceTerritoryMember", "url" : "/services/data/v53.0/sobjects/ServiceTerritoryMember/0HuB0000000TaleKAC" }, "EffectiveStartDate" : "2021-10-22T15:00:00.000+0000", "EffectiveEndDate" : null, "ServiceResourceId" : "0HnB0000000TbgDKAS", "ServiceTerritoryId" : "0HhB0000000TakhKAC" }, { "attributes" : { "type" : "ServiceTerritoryMember", "url" : "/services/data/v53.0/sobjects/ServiceTerritoryMember/0HuB0000000TaloKAC" }, "EffectiveStartDate" : "2021-10-22T15:00:00.000+0000", "EffectiveEndDate" : null, "ServiceResourceId" : "0HnB0000000TbgjKAC", "ServiceTerritoryId" : "0HhB0000000TakhKAC" } ] }
Parse the JSON response, and show the available service resources on the page so that the user can select a primary service resource.
Here’s how a Select Service Resource page can look.
Here’s how a page can look when the user selects a primary service resource.
On the next page in your app, show the selected primary resource. You can also show the other service resources, including assets, so that users can add them as required resources. Then, show the consolidated time slots for all the selected resources.