- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 09:51 PM
Hello,
It is known that when a group approval record (sysapproval_group) is created, then it automatically creates approver records (sysapproval_approver) for all the members in the assignment group field of this group approval record.
As per our script, when a jira ticket is created with certain conditions, it creates change request in ServiceNow and in this script we have a code to include group approval record. script is :
if (istest) {
var TestApprovalGroupSysId = '2d7ad11987b615103ab364e70cbb3523';
this.createGroupApproval(TestApprovalGroupSysId, SNChangeSysID, undefined, 'requested');
gs.eventQueue("change_request.approver.inserted", snChange);
}
createGroupApproval: function(newApproverGroupSysId, SNChangeSysID, dateTime, approvalState) {
var approval_group = new GlideRecord('sysapproval_group');
approval_group.initialize();
approval_group.approval = approvalState;
approval_group.assignment_group = newApproverGroupSysId;
approval_group.parent = SNChangeSysID;
approval_group.sys_created_by = 'integrationuser';
var createdApprovalGroupSysId = approval_group.insert();
if (dateTime) {
// this is only way to set sys_created_on because it can't be set on insert
approval_group.setValue('sys_created_on', dateTime);
approval_group.update();
}
},
With this, when jira ticket is created with certain conditions, group approval record is getting created but this is not generating individual approver records for the members of the assignment group in group approval. How to correct it? Please help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2022 12:52 AM
you didn't link both the records
var approval_gr = new GlideRecord('sysapproval_approver');
approval_gr.initialize();
approval_gr.state = approvalState;
approval_gr.approver = newApproverSysId;
approval_gr.sysapproval = SNChangeSysID;
approval_gr.sys_created_by = 'integrationuser';
approval_gr.group = createdApprovalGroupSysId;
var createdApproverSysId = approval_gr.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
11-11-2022 12:54 AM
Hi @Demo24
Please input some log statements and see, if there are any values printed under
groupmembers array and I believe the function createApproverRecord is not been executed
Try placing some log statements and check if there is any response and let us know
Regards
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 10:55 AM
Hi @Demo24
I'm working as a pre-sales engineer with Exalate.
I can see there is already an approved solution but please let me introduce Exalate.
May I suggest you have a look at our decentralized solution please; it has the capability to syncronize all entity types between SNOW and Jira.
Exalate is easy and straightforward to set-up and you can control exactly which data you want to send and/or receive.
If you would like to see a customized demo of the product, please book a slot.
Cheers