- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 03:29 AM
if all case of an account have been escalated then respective account should get auto escalate
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 03:42 AM
Hi @Prakash_S ,
You can create after BR on case table and use below script.
var accountId = current.account;
if (accountId) {
// Query all active cases of the account
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addEncodedQuery('active_escalationISNOTEMPTY^account=' + accountId + '^active=true');
caseGR.query();
var allEscalated = true;
if (caseGR.next()) {
allEscalated = false;
}
// If all cases are escalated, escalate the account
if (allEscalated) {
var accountEscGR = new GlideRecord('sn_customerservice_escalation');
accountEscGR.initialize();
accountEscGR.source_record = accountId;
accountEscGR.request_source = 1;
accountEscGR.insert();
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 04:20 AM
you can use flow designer for this with no-code design
OR
use after update BR on Case table with below script
Condition: Active Escalation Changes and Active Escalation IS NOT EMPTY
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addQuery('account', current.account);
caseGR.addEncodedQuery('active_escalationISNOTEMPTY');
caseGR.query();
if (!caseGR.hasNext()) {
// All cases are escalated, escalate the account
var escalationGr = new GlideRecord('sn_customerservice_escalation');
escalationGr.initialize();
escalationGr.source_record = current.account;
escalationGr.source_table = 'customer_account';
escalationGr.request_source = 0;
escalationGr.insert();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 03:42 AM
Hi @Prakash_S ,
You can create after BR on case table and use below script.
var accountId = current.account;
if (accountId) {
// Query all active cases of the account
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addEncodedQuery('active_escalationISNOTEMPTY^account=' + accountId + '^active=true');
caseGR.query();
var allEscalated = true;
if (caseGR.next()) {
allEscalated = false;
}
// If all cases are escalated, escalate the account
if (allEscalated) {
var accountEscGR = new GlideRecord('sn_customerservice_escalation');
accountEscGR.initialize();
accountEscGR.source_record = accountId;
accountEscGR.request_source = 1;
accountEscGR.insert();
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2024 04:20 AM
you can use flow designer for this with no-code design
OR
use after update BR on Case table with below script
Condition: Active Escalation Changes and Active Escalation IS NOT EMPTY
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addQuery('account', current.account);
caseGR.addEncodedQuery('active_escalationISNOTEMPTY');
caseGR.query();
if (!caseGR.hasNext()) {
// All cases are escalated, escalate the account
var escalationGr = new GlideRecord('sn_customerservice_escalation');
escalationGr.initialize();
escalationGr.source_record = current.account;
escalationGr.source_table = 'customer_account';
escalationGr.request_source = 0;
escalationGr.insert();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader