Hi there,
I have 2 processes. From the first process, upon selection of an optionset value, the form should re-load with the 2nd process. I tried setting the active process with the corresponding process id but when it re-load, it loads the form with the same process (not 2nd process).
Below is the code i've used. Please let me know what i am doing wrong and how can i re-load the form with the 2nd process.
function SwitchToDifferentProcess( context ) { var FormToComplete = context.getEventSource().getValue(); var CONST_CommunicationProcessID = "27a0c18f-dbff-4843-80ea-6aeceb7eaaa1"; var CONST_ReliabilityProcessID = "1fcd5ebf-7254-449e-88be-aba1e9ed0a93"; var CONST_LevelIIProcessID = "146d992c-fbf7-4b40-b866-57096325fcd4"; var CONST_LevelIIIProcessID = "23656272-d29f-4c59-b385-987f0e47fc0c"; var CONST_Reliability = 450640000; var CONST_Level2 = 450640002; var CONST_Level3 = 450640003; var CONST_AdministrativeStageID = '3b064785-8489-452b-bc3f-798313558f7e'; var CONST_Administration60StageID = '824ba06f-8f91-4710-be6c-67ad3b82a4cc'; var CONST_Administration60LevelIIStageID = 'f0eb8aa1-07cf-4b6c-9086-a5e05cce97b3'; if ( !WebSCPS.Common.isNullOrUndefined( Xrm.Page.data.process.getActiveProcess() ) ) { var activeProcess = Xrm.Page.data.process.getActiveProcess(); if ( FormToComplete == CONST_Reliability ) { if ( CONST_ReliabilityProcessID != activeProcess.getId() ) { Xrm.Page.data.process.setActiveProcess( CONST_ReliabilityProcessID ); Xrm.Page.data.process.setActiveStage( CONST_AdministrativeStageID ); } } else if ( FormToComplete == CONST_Level2 ) { if ( CONST_ReliabilityProcessID != activeProcess.getId() ) { Xrm.Page.data.process.setActiveProcess( CONST_LevelIIProcessID ); Xrm.Page.data.process.setActiveStage( CONST_Administration60StageID ); } } else if ( FormToComplete == CONST_Level3 ) { if ( CONST_ReliabilityProcessID != activeProcess.getId() ) { Xrm.Page.data.process.setActiveProcess( CONST_LevelIIIProcessID ); Xrm.Page.data.process.setActiveStage( CONST_Administration60LevelIIStageID ); } } } var incidentID = Xrm.Page.data.entity.getId(); Xrm.Page.data.entity.save(); var windowOptions = { openInNewWindow: true }; Xrm.Utility.openEntityForm( "incident", incidentID, null, windowOptions ); }
Thank you