Script include to query a record and set the value of specific field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 12:39 AM
Hi Team,
We need a script include to query 'sysapproval_approver' table and check if approval type is parallel.
For those records, we need to set the field 'parallel approvals intiated' as true from client script by calling above script include.
below screenshot is for your reference:
Please help with the code
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 10:19 PM
And i wanted to know,
if we give implemented as 'server script' will this work?
Please help!
This is bit urgent business need!
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 01:51 AM
Hello Sri,
Yes this should work if we implement it as server side:
please share your lates script. and yes the below condition needs to be added in query. it was type in my script:
sysApprovalGR.addQuery("sysapproval", parent.getUniqueValue());
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 02:12 AM
Hi Mahendra,
This is my script:
(function () {
gs.addInfoMessage("To intiate parallel series:::"+parent.getUniqueValue());
var sysApprovalGR = new GlideRecord("sysapproval_approver");
sysApprovalGR.addQuery("sysapproval",parent.getUniqueValue());
sysApprovalGR.addQuery("u_approval_type", "parallel");
sysApprovalGR.query();
while (sysApprovalGR.next()) {
sysApprovalGR.setValue("u_parallel_approvals_initiated", true);
sysApprovalGR.update();
}
gs.addInfoMessage("Parallel Approval Inititated");
})();
But nothing is working after the confirmation!
Please help!
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 02:40 AM
Hello Sri,
Could you please confirm share the screenshot of your action assignment that you have created. It should work actually If you change the implemented as to Script Include.
1. Try to add info message inside while() loop and check if the control is going inside the while loop.
2. If the control is not going inside the while() loop that means the user who is trying to update does not have read access on sysapproval_approver table
3. if the control is going inside the while() loop but still the record is not getting updated then it means the user is not have the write access. Also check if there is any ACL that is restrict the admin user from updating u_parallel_approvals_initiated field.
You may need to check the ACL on sysapproval_approver table. I had checked this with admin access and the approval record was getting updated
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 03:17 AM
Hi Mahendra,
Please refer below screenshots:
And this is where, we need to change,
There is no ACL for the fields, which I have created.
Infact, these are the fields which i have created and i have admin access in the instance.
Please help, This is bit urgent!
Thanks,
Sri