I want workflow to be triggered multiple times and create multiple versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2018 04:11 PM
I have an approval workflow that is triggered halfway through a process (not involving a workflow) and the trigger starts whenever the stage of the process is "Awaiting Approval". There are cases when if the user rejects the approval, the process goes back one stage until the end-user fulfills a task and resends the process to the stage "Awaiting approval)
Everything is working fine except:
1. I want to change the status of a field from another table
2. No new approvals are created and I believe the reason is that the workflow is not re-running from the start even though the stage has come back to "Awaiting Approval"
Below is an image demonstrating the trigger of the workflow (I'm sure it has to do with the condition being "is" insted of "changes to", which doesn't exist as an option.
Thanks!!!!
- Labels:
-
Best Practices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2018 09:44 AM
Maybe rollback is a better solution in this case: https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/administer/workflow-activities/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2018 12:06 PM
Yes, let me try it...On another note, my worfkflow has a script activity that creates a record on a related table and modifies a value on an existing record form that same related table but it works halfway. I can't seem to succesfully modify the value of the existing record. This is the script:
current.comments = new ApproverUtils().getRejectedComents(current);
current.u_stage = '2';
var country = current.u_country;
var region = current.u_country.u_region;
var tower = current.u_tower;
var supplier = current.company;
var stage = current.u_stage;
var area = current.u_area;
var group = '';
group = new RFSUtils().getSupplierGroup(supplier,tower,region,country);
var gr = new GlideRecord('u_proposal');
gr.addQuery('approval', 'not requested');
gr.addQuery('parent', current.number);
gr.query();
gr.approval ='rejected';//<---------THIS IS WHERE THE VALUE IS SUPPOSED TO BE UPDATED
gr.update();
var str = 'WF - Ticket number: ' + current.number + '\n';
str += 'WF - Approval Number: ' + gr.number + '\n';
str += 'WF - Approval: ' + gr.approval + '\n';
str += 'WF - Parent: ' + current.number + '\n';
gs.log (str,'RFS query');
var nr = new GlideRecord('u_proposal');
nr.initialize();
nr.description = current.description;
nr.assignment_group = group;
nr.parent = current.sys_id;
nr.short_description = 'Technical Solution has been completed, proceed to add a financial proposal.';
nr.insert();
I've checked the values in the choices and they are correct, I know its weird that rather thatn the value being "not_requested", it is "not requested".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2018 12:35 PM
After: gr.query(); - you're missing
if (gr.next()){
gr.approval ='rejected';
gr.update();
}