We would like to be able to dynamically update Appointments with Service Activities (S/As).
Specifically, we have a workflow that creates a travel start activity for any field service S/A's, and also creates a trailing appointment for the return travel. This creates an association between the Case for the SA and the Appointments and works fine. We do this so that we can isolate what is travel time from actual service delivery time, since that functionality does not exist OOB with S/As.
However, in cases where the S/A date/time is changed, users have to manually update both the start/end travel appointments which is labor intensive, and prone to errors. We are looking for a solution to automate this.
We were thinking that because we are creating an internal SQL relationship between the Appointment and both the Service Activity and Parent Case in the workflow, there must be a way to leverage this internally, so that when we update the S/A, we know which two Appointments to also update. But so far no luck.
Another idea is to create a 'tracking token' by creating a unique GUID (ex. script below) that we could enter into every SA and it's 2 matching (start/stop) travel Appointments and then match based on that. The current workflow would pull that from the SA and enter it into a field on the Appointments. Seems that would work for new records but we don't know how we'd do this for existing records.
We're now starting to wonder if the only way to accomplish this will be to create a plugin.
Any ideas or input would be appreciated. We need a fresh perspective on this one - been at it for a few days and probably have tunnel vision as a result.
Thank you -Daniel
Example GUID generator:
function GUIDGenerator() {
var S4 = function () {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
function fillGUID(context) {
var name = Xrm.Page.data.entity.attributes.get('new_name').getValue();
if (name == null) {
name = GUIDGenerator();
Xrm.Page.data.entity.attributes.get('new_name').setValue(name);
}
}
function GUIDGenerator() { var S4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); }; return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());}
function fillGUID(context) { var name = Xrm.Page.data.entity.attributes.get('new_name').getValue(); if (name == null) { name = GUIDGenerator(); Xrm.Page.data.entity.attributes.get('new_name').setValue(name); }}









