![]() ![]() I won’t go into the ins and outs of JSON and you can certainly find out more with a quick web search, but what you need to know is that the results from the call are slightly different from the REST API call. The method returns the results as a JSON string. ![]() Parsing the Results – they’re different from the REST API results Hooray! This is what is so awesome about this new API and makes code based development for Scheduler so much easier for these types of use cases. Since the running user is already authenticated, they can call the Scheduler API, just like they can call any other Apex Method they have access to. Note, that no authentication code, connected apps, named credentials and other items are required to call the Apex Method. It is super simple and is represented by this line in the example code: String response = (input) You can of course change this to be more dynamic. I’ve hard coded the EndTime to be the Start Time plus 3 days. As you can see in the example code, I simply set the parameters to the values passed in from the flow. The Get Appointment Candidates API provides an easy to use class to set the parameters that you want to pass to the Get Appointment Candidates API, lxscheduler.GetAppointmentCandidatesInput. Setting the Input Parameters in the Apex Method Variables like Account Id are not mandatory, I’ve just included it in my example. We use these values to call the Scheduler Method. ![]() It contains variables for Work Type Group Id, Service Territory Id, Scheduling Policy Id, Account Id and Start Date Time. In the example code below, to accept the input parameters from the flow, I created a class called payloadIn. Receiving the Input Parameters from the Flow For this example, the method I created takes in the parameters, calls the Scheduler Apex Method named, and returns the first result found, or returns nothing if no slots are found. There are lots of great articles and tips on building which I won’t go into here. Apex ClassĪs you probably already know, you can call Apex Methods from a Lightning Flow using the Action component. If a slot is returned, it creates a service appointment, if not, an informational message is displayed. It passes these parameters into the Apex Action. It prompts the user for Work Type Group, Territory and Earliest Start Time. It takes in the account id from the Account Page. Screen FlowĪs you can see in the screen shot below, the flow is pretty simple. The top left of the 2 screen shots below illustrate how the call center user can ask the scheduler to return the next available time slots and create a service appointment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |