Setting up Booking Recurrence

This post is a part of a “Field Service for Citizen Developers” series. Click here to see other posts.

Work Orders can be automatically generated and bookings can be auto-generated by Dynamics 365 Field Service, thanks to the Agreements functionality in the system. Agreements are used for setting up preventative maintenance schedule, audits, equipments/fleet service schedule etc. in the system, which then generates work orders and booking automatically – resulting in obvious productivity gains.

One of the key steps in setting up agreements is to setup recurrence of the work orders (and subsequently but optionally, bookings) generated by the system. This option is part of the ‘Agreement Booking Setup’.

Booking Recurrence – how to setup?

Clicking on the Booking Recurrence in ‘Agreement Booking Setup’ record, opens up a screen similar to (but more complex than) meeting invite recurrence screen of Outlook:

The screen lets you define following recurrence patterns:

  • Daily
    • every day or every work day
    • every # of day(s)
  • Weekly
    • day of the week
    • every # of week(s)
  • Monthly
    • day of the month OR day of the specific week of the month
    • every # of month(s)
  • Yearly
    • day of the month OR specific day of the month & week of the year
  • Duration:
    • Start and End dates (end date is optional)
  • Custom dates: Any custom dates for generating work orders and bookings (for example, you may want to setup servicing assets more frequently during the holiday season)

Booking Recurrence – how to import?

The use case here is when you would like to import service agreement into Dynamics 365 field service, you may want to import recurrence as well. The challenge here is that there is only /one/ field behind the entire recurrence screen:

FieldTypeNotes
Recurrence SettingsMultiple line of text Data is stored in XML format

Couple of examples here to see how it works:

  1. On setting up recurrence as โ€˜daily’ and start & end dates as 1/1/2020 to 31/12/2020, data saved in Recurrence Settings field is:
<root>
	<pattern>
		<period>daily</period>
		<option>every</option>
		<days every='1'>
		</days>
	</pattern>
	<range>
		<start>01/01/2020</start>
		<option>endBy</option>
		<end>12/31/2020</end>
	</range>
	<datas/>
</root>
  1. On setting up recurrence as โ€˜weekly – every Sunday’ and start & end dates as 1/1/2020 to 31/12/2020, data saved in Recurrence Settings field is:
<root>
	<pattern>
		<period>weekly</period>
		<option>every</option>
		<weeks every='1'>
			<days>0</days>
		</weeks>
	</pattern>
	<range>
		<start>01/01/2020</start>
		<option>endBy</option>
		<end>12/31/2020</end>
	</range>
	<datas/>
</root>
  1. On setting up recurrence as โ€˜weekly – every Saturday’, 30/1 and 31/1 as custom dates, and start & end dates as 1/1/2020 to 31/12/2020, data saved in Recurrence Settings field is:
<root>
	<pattern>
		<period>weekly</period>
		<option>every</option>
		<weeks every='1'>
			<days>6</days>
		</weeks>
	</pattern>
	<range>
		<start>01/01/2020</start>
		<option>endBy</option>
		<end>12/31/2020</end>
	</range>
	<datas>
		<data>01/31/2020</data>
		<data>01/30/2020</data>
	</datas>
</root>

As you can see, data is saved as xml which is based on standard format (called XSD). This XSD is not published but the format is consistent.

Therefore, to import booking recurrence, the first consideration is how the data extract to be imported is fashioned. If to-be imported records need to have the same recurrence, xml can be created manually per above format and added to the excel/csv before import. If there are different recurrence patterns, a code-based solution or excel macro can be used to fashion xml, per above format, against each row of data extract.

Thanks for visting, please feel free to share if you have any feedback or questions. Cheers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.