Update the Approval record via the workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 12:01 PM
HI All,
I have a requirement that I need to update the approval record via the workflow.
The workflow is on the Knowledge management table(kb_knowledge) and the field I want to update is on the sysapproval_approver table.
Example: The state value on the Knowledge Management table(kb_knowledge) need to populate in the short description field (sysapproval_approver) table.
I want to do this via the workflow.
Thanks in advance much help would be appreciated.
Regards,
Ajay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 12:12 PM
Hi Ajay,
After the approval action by user or by group add run script block for both rejected and approved flow and add the script to update the short description.
Thanks,
Arindam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 12:24 PM
Hello Arindam,
My Requirement is entirely different.Can you please look into the question I want to update the approval Record on the insert. Moreover, I need to query two tables.
I am not speaking about the approval actions. Please, raise if did not understand my question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 12:53 PM
Hi Ajay,
I think I understood your question . But what I thought was you are going to update the field after approve or reject.
Now I came to know that you want to update that while inserting into sysapproval_approver table. So now my solution will be same but you need to add the run script block before approval user block.
what the below script will do is it will loop through all the approval and will update the kb status in short description one by one.
The script will be like below:
var gr= new GlideRecord("sysapproval_approver");
gr.addQuery("approving",current.sys_id);
gr.query();
while(gr.next()){
gr.short_description = current.state+' - '+gr.short_description; //Change this script based on your requirement
gr.update();
}
Thanks,
Arindam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 01:14 PM
Hi Ajay,
I almost had a same requirement, for RITM , instead of KB.
And I created approvals using run script,
var gr = new GlideRecord('sysapproval_approver');
gr.initialize();
gr.sysapproval = current.sys_id;
gr.approver = current.u_requested_for.manager.sys_id;
gr.state = 'requested';
gr.insert();
// capturing the sys id . to be used throughout the workflow if needed.
workflow.scratchpad.managerApproval = gr.sys_id;
Then a 'wait for' activity to pause the workflow until the approval is acted on
Then a 'If' condition to route the workflow based on approval/rejection.
This was necessary for our instance, as the approval notifications went wacky ,on trying to update the approval object after creation.
Would be curious, if there is better/easier way to get this done.