{"id":4218,"date":"2017-01-05T16:09:58","date_gmt":"2017-01-05T10:39:58","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=4218"},"modified":"2017-01-05T16:09:58","modified_gmt":"2017-01-05T10:39:58","slug":"configure-booking-recurrence-pattern-based-on-custom-optionset","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/01\/configure-booking-recurrence-pattern-based-on-custom-optionset\/","title":{"rendered":"Configure Booking Recurrence Pattern based on Custom OptionSet"},"content":{"rendered":"<p style=\"text-align: justify;\"><strong>Introduction<\/strong>:<\/p>\n<p style=\"text-align: justify;\">In the Field Service, we can provide preventive maintenance to the client, based on the recursive work order.<\/p>\n<p style=\"text-align: justify;\">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.<\/p>\n<p style=\"text-align: justify;\"><strong>OOB Functionality to Configure the Booking Recurrence:<\/strong><\/p>\n<p style=\"text-align: justify;\">First, create an Agreement record for the customer.<\/p>\n<p><img decoding=\"async\" class=\" wp-image-4212 aligncenter\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/1-1024x286.jpg\" alt=\"Create an agreement record\" width=\"791\" height=\"220\" \/><\/p>\n<p style=\"text-align: justify;\">And, then create a Booking Setup record associated with this Agreement.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-4213\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/2.jpg\" alt=\"create a Booking Setup record associated with this Agreement\" width=\"369\" height=\"119\" \/><\/p>\n<p style=\"text-align: justify;\">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.<\/p>\n<p style=\"text-align: justify;\"><strong>Configure Booking Recurrence Pattern:<\/strong><\/p>\n<p style=\"text-align: justify;\">To configure the Booking Recurrence pattern, user needs to navigate to the Booking Setup record and click on the \u201cBOOKING RECURRENCE\u201d Button as shown in the below picture.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-4214\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/3.jpg\" alt=\"3\" width=\"791\" height=\"265\" \/><\/p>\n<p style=\"text-align: justify;\">Once the user clicks on the \u201cBOOKING RECURRENCE\u201d button, the following window is opened, where the user provides the required information.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-4215\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/4.jpg\" alt=\"Recurrence Configuration\" width=\"601\" height=\"500\" \/><\/p>\n<p style=\"text-align: justify;\">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.<\/p>\n<p style=\"text-align: justify;\"><strong>One Click solution<\/strong>:<\/p>\n<p style=\"text-align: justify;\">To make the above process simple for a User, we can make a custom Option Set field \u201c<strong>Booking Recurrence<\/strong>\u201d on the Booking Setup form with the most commonly used option values like \u201cMonthly\u201d, \u201cQuarterly\u201d, \u201cBi-annually\u201d and \u201cAnnually\u201d as indicated in the below picture.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter  wp-image-4216\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/01\/5.jpg\" alt=\"Booking Setup form\" width=\"792\" height=\"401\" \/><\/p>\n<p style=\"text-align: justify;\">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.<\/p>\n<p style=\"text-align: justify;\">To develop the above functionality, follow the below steps.<\/p>\n<ol style=\"text-align: justify;\">\n<li>We found that there is a \u201c<strong>Recurrence Setting<\/strong>\u201d 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.<\/li>\n<li>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.<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">The structure of the XML string for most commonly used Booking Recurrence Pattern is given below.<\/p>\n<p style=\"text-align: justify;\"><strong>For Monthly:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">var recurrenceSettingXml = \n\"&lt;root&gt;&lt;pattern&gt;&lt;period&gt;monthly&lt;\/period&gt;&lt;option&gt;every&lt;\/option&gt;&lt;months every='1'&gt;&lt;day&gt;1&lt;\/day&gt;&lt;\/months&gt;&lt;\/pattern&gt;&lt;range&gt;&lt;start&gt; AGREEMENTSTARTDATE &lt;\/start&gt;&lt;option&gt;endBy&lt;\/option&gt;&lt;end&gt; AGREEMENTENDDATE &lt;\/end&gt;&lt;\/range&gt;&lt;datas\/&gt;&lt;\/root&gt;\"\n<\/pre>\n<p><strong>For Quarterly:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">var recurrenceSettingXml =\n\"&lt;root&gt;&lt;pattern&gt;&lt;period&gt;monthly&lt;\/period&gt;&lt;option&gt;every&lt;\/option&gt;&lt;months every='3'&gt;&lt;day&gt;1&lt;\/day&gt;&lt;\/months&gt;&lt;\/pattern&gt;&lt;range&gt;&lt;start&gt; AGREEMENTSTARTDATE &lt;\/start&gt;&lt;option&gt;endBy&lt;\/option&gt;&lt;end&gt; AGREEMENTENDDATE &lt;\/end&gt;&lt;\/range&gt;&lt;datas\/&gt;&lt;\/root&gt;\"\n<\/pre>\n<p><strong>For BI-Annually:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">var recurrenceSettingXml =\n\"&lt;root&gt;&lt;pattern&gt;&lt;period&gt;monthly&lt;\/period&gt;&lt;option&gt;every&lt;\/option&gt;&lt;months every='6'&gt;&lt;day&gt;1&lt;\/day&gt;&lt;\/months&gt;&lt;\/pattern&gt;&lt;range&gt;&lt;start&gt; AGREEMENTSTARTDATE &lt;\/start&gt;&lt;option&gt;endBy&lt;\/option&gt;&lt;end&gt; AGREEMENTENDDATE &lt;\/end&gt;&lt;\/range&gt;&lt;datas\/&gt;&lt;\/root&gt;\"\n<\/pre>\n<p><strong>For Annually:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">var recurrenceSettingXml =\n\"&lt;root&gt;&lt;pattern&gt;&lt;period&gt;yearly&lt;\/period&gt;&lt;option&gt;every&lt;\/option&gt;&lt;years every='11'&gt;&lt;day&gt;1&lt;\/day&gt;&lt;\/years&gt;&lt;\/pattern&gt;&lt;range&gt;&lt;start&gt; AGREEMENTSTARTDATE &lt;\/start&gt;&lt;option&gt;endBy&lt;\/option&gt;&lt;end&gt; AGREEMENTENDDATE &lt;\/end&gt;&lt;\/range&gt;&lt;datas\/&gt;&lt;\/root&gt;\"\n<\/pre>\n<p style=\"text-align: justify;\">\u00a0Where,<\/p>\n<ul>\n<li style=\"text-align: justify;\"><strong>AGREEMENTSTARTDATE<\/strong> \u2013 \u201cAgreement start date\u201d of Agreement record.<\/li>\n<li style=\"text-align: justify;\"><strong>AGREEMENTENDDATE<\/strong> \u2013 \u201cAgreement end date\u201d of Agreement record.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">So, to develop the above functionality, we write a JavaScript code which generates the\u00a0<strong>XML\u00a0string<\/strong> based on the selected option set and set it to the \u201c<strong>Recurrence Setting<\/strong>\u201d field. And finally, the OOB workflow is triggered on change of the \u201c<strong>Recurrence Setting<\/strong>\u201d which will generate the Booking Date records.<\/p>\n<p style=\"text-align: justify;\"><strong>Code Snippet:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">Xrm.Page.getAttribute(\"msdyn_recurrencesettings\").setValue(recurrenceSettingXml);\nXrm.Page.getAttribute(\"msdyn_recurrencesettings\").setSubmitMode(\"always\");\n<\/pre>\n<p style=\"text-align: justify;\">\u00a0<strong>Conclusion:<\/strong><\/p>\n<p style=\"text-align: justify;\">This would help users to create Booking Date records with just a click and avoid all the steps needed to follow the OOB procedure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: 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\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/01\/configure-booking-recurrence-pattern-based-on-custom-optionset\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":4217,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[216,316,317,1273],"class_list":["post-4218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-field-service-2","tag-booking-recurrence-pattern","tag-configure-booking-recurrence-pattern","tag-configure-booking-recurrence-pattern-based-on-custom-optionset","tag-oob-functionality-to-configure-the-booking-recurrence"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=4218"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4218\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/4217"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=4218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=4218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=4218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}