Requirement trigger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 12:19 AM
I have one requirement on Change _ request table:-
when the user click on request for approval button , check approval affected CIs/services and condition are if approval group and Owned by is Available trigger approval for approval group and owned by , if approval group is not available and if owned by is null then check if managed by group is available then it trigger approval to managed by .
actually we need to achieve this through Business rule , previously we are trying workflow it takes time .
I created business rule change_request after insert .
answer = [];
var a = current.sys_id;
var gr = new GlideRecord('task_ci');
gr.addEncodedQuery('task=' + a);
gr.query();
var approvalGroup = null;
var ownedBy = null;
var managedBy = null;
while (gr.next()) {
var ap = gr.ci_item.change_control;
var owned = gr.ci_item.owned_by;
var mana = gr.ci_item.managed_by;
if (ap != null && approvalGroup == null) {
approvalGroup = ap;
}
if (approvalGroup == null && owned != null && ownedBy == null) {
ownedBy = owned;
}
if (approvalGroup == null && ownedBy == null && mana != null && managedBy == null) {
managedBy = mana;
}
}
Please let me know if this we can achieve . Help me to resolve this through business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 12:31 AM
@Community Alums
you want this on click of button then why to use BR?
Why not add the code in the UI action itself?
what debugging have you done so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:04 AM - edited 08-22-2023 02:21 AM
Hello Ankur @Ankur Bawiskar ,
firstly we tried make version 2 and applied tried to write workflow code , but later the requirement changes , already request approval button OOTB UI action is der but that is not for this requirement , please let me know how we can achieve this on UI action , or can we create UI action on change_request table . if it is yes then how we can achive this .
PLease let me know , it will be really helpful for me if we can achieve this through UI