Script include to query a record and set the value of specific field

Sri56
Tera Contributor

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:

find_real_file.png

Please help with the code

Thanks,

Sri

 

34 REPLIES 34

What about the info logs inside while loop did you tried that. Because it seems that there could be some cross scope access issue as you are making change in sysapproval_approver table from scoped application. 

If you have not yet tried the option to add Info message then please check with that then only we will come to know. If you have already tried then you should have mentioned the outcome of those points.

Also go to the Application scope in which your agent workspace is and then try to update anyone sysapproval_approver record's paralled approval initiated field by using the similar script in background script on your instance.

------------------------------------
Also go to cross scope privileges table and search with source scope is CSM and FSM configurable workspace foundation and please share the screenshot. Please try all this option and share the result. Your previous screenshot were not clear so please try to share screenshot that are easy to read.

Also I would appreciate if you could mark my above responses as helpful

Thanks

Hi Mahendra,

None of my logs are working.

Can we please connect now and identify what needs to be done here please?

Thanks,

Sri

Hi Mahendra,

If i try from background script, its working fine:

gs.print("parallel approvals!!");
var app = new GlideRecord('sysapproval_approver');
app.addQuery('sysapproval','8e958d471bf9511006c7db58bb4bcbb9');
app.addQuery('u_approval_type','parallel');
app.query();
while(app.next())
{
app.setValue('u_parallel_approvals_intiated',true);
app.update();
}

same if i copy and paste inside the server script action assignement code:

var app = new GlideRecord('sysapproval_approver');
app.addQuery('sysapproval',parent.getUniqueValue());
app.addQuery('u_approval_type','parallel');
app.query();
while(app.next())
{
app.setValue('u_parallel_approvals_intiated',true);
app.update();
}

Its not working!

Please help me here!

 

Thanks,

Sri

you can share the link to join..

please provide your email address?

Thanks,

Sri