Hi,
I am trying to solve what I presume will be quite common need.
In Field Service we have Customer Assets and Service Accounts.
We have routine maintenance bookings on either monthly, bi-monthly, quarterly or half yearly recurrence for customer assets.
We also need to have one annual maintenance booking and in turn cancel the normal booking so a monthly would have 11 normal and one annual booking. The difference is the annual has extra service tasks compared to a normal booking
The easy way I see to solve this is have a normal and a annual booking setup and when it's created do a lookup of normal bookings and cancel / delete the normal booking. If the agreements are setup with the same recurrence start date this is quite simple as they will both fall on the same date. This also carries a risk if the plugin runs before the normal booking is generated.
The problem in this instance is that the anniversary date (agreement) and booking (recurrence start date) are different and the anniversary should drive the annual date i.e. 12 months from anniversary. To change the recurrence start date can be done however it's over 500 assets which I can do relatively easily through ssis however as it's production would preferably not just in case it causes issues.
My next idea was to have a plugin:
Set to pre create of workorder
Check is maintenance work order
Look up agreement start date
Check agreement start date against booking date with something like this:
Get entityreference from msdyn_primaryincidenttype to msdyn_incidenttype
Update msdyn_incidenttype to annual incident type
Hopefully this would work and populate with correct service tasks. I'm a little concerned whether it may still get updated / overwritten after this by agreementbookingincident entity.
I would just change on Post Create however the Incidentype to workorder service task is referential so would need to delete existing service tasks, update incident type.
Not far off testing in a sandbox however was just after some thoughts or ideas!
*This post is locked for comments