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-14-2022 01:25 AM
Hi Mahendra,
Above solution is not working.
what should be the new value in above client script.
Moreover, we are defining above client script in sys_declarative action table as imlemented as field as client script.
and i please find the below requirement once again:
So requirement is, when i click on intiate parallel button(on configurable workspace) I need to query a records which is of approval type as parallel and for those records, i need to set the value of parallel approvals intiated value to true.
As above, when agent clicks on intiate parallel button,
Please do help on this.
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 01:35 AM
Hi Mahendra,
Can you please help on this?
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 02:39 AM
Hi Mahendra,
This is partially working.
How do we restrict the script include for current record only?
Please help!
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 03:13 AM
Hello Sri,
You have created the action assignment Initiate Parallel with Implemented as Client Script. You need to change that to Implemented as Script Include then use the below script in Script field:
(function () {
var sysApprovalGR = new GlideRecord("sysapproval_approver");
sysApprovalGR.addQuery("sysapproval_approver", 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");
})();
On condition tab do not specify any condition.
On confirmation tab you can add the confirmation message so that if someone click by mistake it should ask user for confirmation. once user confirm then the Approval will be inititated:
You should be able to acheive your requirement.
Please do mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 06:18 AM
Hello Sri,
Just wanted to check with you, if the above response answered your question. If yes, then please do close this thread/question by marking the appropriate response as correct.
Thanks