Configure Booking Recurrence Pattern based on Custom OptionSet

By | January 5, 2017


In the Field Service, we can provide preventive maintenance to the client, based on the recursive work order.

To create recursive work order automatically based on certain date interval, we need to configure the Booking Recurrence pattern. To configure, we set the date interval and based on this date interval the Booking Date record is automatically created. Booking Date record in the Field Service describes at which date the Work Order record should be created for the customer. Based on the Booking Date records the work order is automatically created for the client.

OOB Functionality to Configure the Booking Recurrence:

First, create an Agreement record for the customer.

Create an agreement record

And, then create a Booking Setup record associated with this Agreement.

create a Booking Setup record associated with this Agreement

After creating the Booking setup record for the Agreement, we need to configure the Booking Recurrence. Once the user configures the Booking Recurrence pattern, then based on it, the Booking Date records is automatically created.

Configure Booking Recurrence Pattern:

To configure the Booking Recurrence pattern, user needs to navigate to the Booking Setup record and click on the “BOOKING RECURRENCE” Button as shown in the below picture.


Once the user clicks on the “BOOKING RECURRENCE” button, the following window is opened, where the user provides the required information.

Recurrence Configuration

The above Booking Recurrence pattern is an example of quarterly basis, i.e. the booking dates are brought forth on the interval of 3 months, finally based on Booking Dates record the Work order is generated. To configure the Booking Recurrence Pattern, a User requires too many clicks and needs to provide the information based on his/her requirement as shown in the above Booking Recurrence Pattern window, repeatedly, for each customer.

One Click solution:

To make the above process simple for a User, we can make a custom Option Set field “Booking Recurrence” on the Booking Setup form with the most commonly used option values like “Monthly”, “Quarterly”, “Bi-annually” and “Annually” as indicated in the below picture.

Booking Setup form

And by selecting any one option from the above option set, the Booking Recurrence pattern is automatically generated. Based on the Booking Recurrence pattern, the Booking Date record gets created.

To develop the above functionality, follow the below steps.

  1. We found that there is a “Recurrence Setting” field on the Booking Setup form, but Out of the box, this field is hidden. We need to set an XML string (format of XML string given below) in this field.
  2. Once the XML string is set in this field, an OOB Field Service Workflow is triggered. It generates the Booking Date record based on value provided in the XML string.

The structure of the XML string for most commonly used Booking Recurrence Pattern is given below.

For Monthly:

var recurrenceSettingXml = 
"<root><pattern><period>monthly</period><option>every</option><months every='1'><day>1</day></months></pattern><range><start> AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"

For Quarterly:

var recurrenceSettingXml =
"<root><pattern><period>monthly</period><option>every</option><months every='3'><day>1</day></months></pattern><range><start> AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"

For BI-Annually:

var recurrenceSettingXml =
"<root><pattern><period>monthly</period><option>every</option><months every='6'><day>1</day></months></pattern><range><start> AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"

For Annually:

var recurrenceSettingXml =
"<root><pattern><period>yearly</period><option>every</option><years every='11'><day>1</day></years></pattern><range><start> AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"


  • AGREEMENTSTARTDATE – “Agreement start date” of Agreement record.
  • AGREEMENTENDDATE – “Agreement end date” of Agreement record.

So, to develop the above functionality, we write a JavaScript code which generates the XML string based on the selected option set and set it to the “Recurrence Setting” field. And finally, the OOB workflow is triggered on change of the “Recurrence Setting” which will generate the Booking Date records.

Code Snippet:



This would help users to create Booking Date records with just a click and avoid all the steps needed to follow the OOB procedure.