If requested_by.manager is blank, User Approval is being skipped in Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2012 04:06 PM
In our Change Request workflows the first step is to get approval from the manager of the person requesting the change. This is being done by using the Approval - User option with ${requested_by.manager} in the Users. This works fine as long as the requested_by has a manager associated with them, if manager is blank the change gets automatically approved and the workflow keeps going. I haven't been able to find a way to change this behavior.
Ideally what I would like to do is have another group look at the change if the requested by manager is null, I just haven't figured out how to do this. As a long shot I tried: if (current.requested_by.manager=="NULL") {answer='group ID';}, but that didn't work. The change was still approved automatically.
I was thinking it might be possible to do this with an IF statement in the workflow. If current.requested_by.manager==NULL return YES and the YES point to a group approval with the group I need to look at the change. and with NO pointing to a user approval that uses the requested_by.manager variable like I'm doing now.
It sounds like that would work but for some reason I keep thinking there is a more elegant way of doing this.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2012 07:59 AM
The name is correct, I copied and pasted it from the sys_user_group tabe and there is one active user in the group. I'm adding this script to the User Approval section of the workflow correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2012 09:58 AM
That's all correct. I would suggest you start adding some 'gs.log' lines to the script to see where it's failing. I just tested it again and it works fine for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2012 01:03 PM
I've never done any logging. Could you give me an example of where I could add that on the script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2012 01:15 PM
You can add that anywhere you want in the script. You can include logging statements like this...
gs.log('My log statement: ' + answer);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2012 07:09 PM
I believe it is the sys_id of the Group that you have to use and not the name.
There are however, 2 graphical ways of doing the same thing:
The default "Approved" condition is actually "activity.result == 'approved' || activity.result == 'skipped'". You can remove "|| activity.result == 'skipped'" from the approved condition and put "activity.result == 'skipped'" into a new "Skipped" one.
Or, you can do it this way:
with the following condition: