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 12:55 AM
You can utilize the below code snippet in your script include.
var grApproval = new GlideRecord('sysapproval_approver');
grApproval.addQuery('<backend_name_of_field_approval_type>', '<backend_value_of_parallel_choice>');
grApproval.query();
while(grApproval.next()){
grApproval.setValue('<backend_name_of_field_parallel_approvals_initiated', true);
grApproval.update();
}
Not sure when you want this to happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:01 AM
Hi Muhammed,
please share the client script code as well.
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:17 AM
It does not seem a good approach to use this in client scripts. It would be better if you could explain your requirement in detail then maybe we can find a better solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:20 AM
Hi Muhammed,
This has written on scoped application-'CSM workspace' not on agent workspace.
I have defined the button on 'sys_declarative_action_assignment'table.
Where i have options to implement as server script/client script etc..
I need to query all current records which is of type parallel then only for those records i need to set the field intiated as true when i click the button.
Below screenshot for your reference:
So requirement is, when i click on intiate parallel button, 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,
it should query current record with parallel approval type and highlighted value should be turned from false to true.
Please help,
Thanks,
Sri