- August 21, 2020
- In Dynamics 365, Dynamics 365 Field Service, Dynamics 365 Sales
- No Responses
In Field Service, you can create work orders automatically by using agreements and the interval in which the work orders are created can be set up by using booking recurrence from the agreement booking setup, but this might be confusing and time consuming for clients/users, so in this blog we will see how you can configure the booking recurrence and keep it at just one click.
To achieve this follow the below steps:
The structure of the XML string for most commonly used Booking Recurrence Pattern is given below:
For Creating Bookings Weekly:
var recurrenceSettingXml = "<root><pattern><period>weekly</period><option>every</option><weeks every='1'><days>1</days></weeks></pattern><range><start> AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"
For Creating Bookings Monthly:
var recurrenceSettingXml = <root><pattern><period>monthly</period><option>everyWeekday</option><months every='1'><weekdef>1</weekdef><weekday>7</weekday></months></pattern><range><start>AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"
For Creating Bookings Quarterly:
var recurrenceSettingXml = "<root><pattern><period>monthly</period><option>everyWeekday</option><months every='3'><weekdef>1</weekdef><weekday>7</weekday></months></pattern><range><start>AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"
For Creating Bookings Bi-Annually:
var recurrenceSettingXml = "<root><pattern><period>monthly</period><option>everyWeekday</option><months every='6'><weekdef>1</weekdef><weekday>7</weekday></months></pattern><range><start>AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"
For Creating Bookings Annually:
var recurrenceSettingXml = "<root><pattern><period>yearly</period><option>every</option><years every='1'><day>1</day></years></pattern><range><start>AGREEMENTSTARTDATE </start><option>endBy</option><end> AGREEMENTENDDATE </end></range><datas/></root>"
Where,
So, to finally use this functionality and generate the XML string based on the selected option set value and set it to the Recurrence settings field. You can simply write a JavaScript code for generating the XML string
Use the following code snippet to assign the selected option set’s value to Recurrence settings field:
formContext.getAttribute(“msdyn_recurrencesettings”).setValue(recurrenceSettingXml);
Let started with our D365 Quickstart package and get onboard within 7 days!
I'M INTERESTED!