Hi Grant and Joe,
I'm embarrassed to say that I'd forgotten about that alternative! And I'm sure it would work for Joe's issue.
In the meantime I looked up the function 'cr::site_call_to_change_mapping' which Anthony Lee mentions above (and I didn't know about) and which also came up in this thread: When creating a Change Order from an existing Incident, how can I add an additional argument to be populated in the Change Order?
I took the sample source from %NX_ROOT%\samples\call_mgt\chg_site.spl, copied that to site\mods\majic\chg_site.spl, commented out the other functions in chg_site.spl, edited function site_call_to_change_mapping as below, restarted SDM and the fields shown below are duly copied across from an incident to a change. So there you go, Joe - two solutions for the price of one!
cr::site_call_to_change_mapping(object change)
{
string method; method = "cr::site_call_to_change_mapping";
logf(TRACE,"%s START.",method);
// default the change request group from the call request group
if (!is_null(this.group)) change.group = this.group;
// default the change request assignee from the call request assignee
if (!is_null(this.assignee)) change.assignee = this.assignee;
// Set CHG field 'zAffectedService' from CR 'affected_service'.
if (!is_null(this.affected_service))
{
logf(TRACE, "%s setting zAffectedService", method);
change.zAffectedService = this.affected_service;
}
logf(TRACE,"%s END.",method);
}
Setting the Change Category is still to be sorted. You could hard-code the mapping from the Incident Area to a Change Category into the function site_call_to_change_mapping. But it might be tidier to add a new field to the Incident Area object pcat - something like 'zMappedChgCat' - and make that an SREL to chgcat. Maintain the field 'zMappedChgCat' in the Incident Area detail form, pick it up in 'site_call_to_change_mapping' from the CR category as 'this.category.zMappedChangeCategory', and set the mapped category into the change if it is not null. That would probably be my preference.
Regards,
James