Escalation Process requirement

Prasnajeet1
Giga Guru

HI All

I have requirement where I have to write a business rule on the Task table. The requirement is like,

1, If any task is escalated then no user should be able to change the state to closed or cancelled. and also I have populated a message like "Task is already escalated".

2, On insert

(i). If sc_task table, and RITM item = PC Deployment, then Escalated for = PC Deployment
(ii). If sc_task or sn_hamp_hw_refresh_line_task table, and RITM item = Refresh Order, then Escalated for = Refresh Order
(iii). If sn_hamp_asset_reclaim_task table, and RITM item = Recover Asset, then Escalated for = Recover Asset
(iv). If sc_task table, and RITM item = IMAC Request, then Escalated for = IMAC Request
(v). If sc_task table, and RITM item = Legal Hold Recover Asset, then Escalated for = Legal Hold Recover Asset
 
Can someone please explain or share the script required to achieve the above requirement please?
Thanks in advance.
2 REPLIES 2

Rahul Kumar17
Tera Guru

Hi Prasnajeet,

 

To implement the requirements you've described, you can write a business rule on the Task table with the following script:

 

(function executeRule(current, previous /*null when async*/) {

//check if task is escalated
if (current.escalation && (current.state == '7' || current.state == '6')) {
current.state = previous.state; //revert state change
current.u_message = 'Task is already escalated'; //set message
}

//populate escalated for
if (current.operation() == 'insert') {
var ritmItem = current.variables.ritm_item;
if (ritmItem == 'PC Deployment') {
current.escalated_for = 'PC Deployment';
} else if (ritmItem == 'Refresh Order') {
current.escalated_for = 'Refresh Order';
} else if (ritmItem == 'Recover Asset') {
current.escalated_for = 'Recover Asset';
} else if (ritmItem == 'IMAC Request') {
current.escalated_for = 'IMAC Request';
} else if (ritmItem == 'Legal Hold Recover Asset') {
current.escalated_for = 'Legal Hold Recover Asset';
}
}

})(current, previous);

 

This script checks if the task is escalated and if the user is trying to change the state to closed or cancelled. If so, it reverts the state change and sets a message. It also populates the "Escalated for" field based on the value of the "ritm_item" variable for new records.

Make sure to test the script thoroughly before deploying it to a production environment.

 

Thanks,

Rahul Kumar

 

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

HI Rahul

 

Thank you very much for your support on the script part. You have already explain the complete story still I have few concerns here. Please confirm on the below point. I am implementing the BR on the "OnBefore" BR and on "Update". Also i believe we can write entire script in one BR only. No need to write on multiple BR for above mentioned two scenarios. As per your script I believe it will show the display name of the catalog item not the class or sys_id.

 

Please confirm on all 3 point for my clarification.