We are using setActiveProcess to set the business process flow on the case form based on case record owner. We have several business process flows on the case entity. We have published them on the new Customer Service Hub app and we can switch between the processes via the ribbon button.
The JavaScript function works fine in the old legacy UI but not in the new Unified Interface. The callback function returns 'Invalid'
getActiveProcess and getEnabledProcesses work in the new UI.
Here if the function we are using:
function SetBPF() {
if (Xrm.Page.ui.getFormType() === 1) {
var activeProcess = Xrm.Page.data.process.getActiveProcess();
if (activeProcess != undefined && activeProcess != null) {
var activeProcessId = Xrm.Page.data.process.getActiveProcess().getId();
var ownerName = Xrm.Page.getAttribute("ownerid").getValue()[0].name;
if (ownerName != null && ownerName != undefined && activeProcessId != null) {
if (ownerName.toUpperCase() == TeamName&& activeProcessId.toUpperCase() != ProcessName) {
Xrm.Page.data.process.setActiveProcess(ProcessGUID, successCallback);
}
else if (ownerName == TeamName&& activeProcessId.toUpperCase() != ProcessName) {
Xrm.Page.data.process.setActiveProcess(ProcessGUID, successCallback);
}
else if (ownerName.toUpperCase() != TeamName&& ownerName != TeamName && activeProcessId.toUpperCase() != ProcessName) {
Xrm.Page.data.process.setActiveProcess(ProcessGUID, successCallback);
}
}
}
}
}
Any ideas why this function might not work in the new UI?
Thanks
Phil