how to add approver in workflow depending on selection of user of a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2016 04:28 AM
how to add approver in workflow depending on selection of user for a field like lookup select box?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2016 06:36 AM
Hey Aritra:
You need to script based on the table you created for Lookup Select Box. Modify the following script as per your requirement. In this case "u-catalog_item_approvers" was the table for my Lookup Select Box.
Approval - User Script:
var answer = [];
var approver = new GlideRecord("u_catalog_item_approvers");
var liststr = current.variables.supervisor.toString();
approver.addQuery('u_name','=', liststr);
approver.query();
while(approver.next()){
answer.push(approver.u_name);
'u_catalog_item_approvers' is a table for 'Look Up Select Box' variable.
Hope this helps.
Hit it Correct, as you see the impact.
Kind regards
Danny Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 03:44 AM
answer='';
var approver= new GlideRecord('sys_user');
var nm =current.variables.manager;
approver.addQuery('name','is','nm');
approver.query();
while(approver.next())
{
answer=''+approver.name;
}
i have written this , but this not working. can you tell me the mistake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 06:28 AM
Hi Arithra:
I thought, you had a separate look up select box, from which a user selects the approver. In your script, you are selecting 'sys_user' table! That may be the problem. Why don't you create a table, for there are not going to be a whole lot of managers(approvers) to select from, and then script exactly like my script and give it a try. It worked fine for me.
Cheers!
P.S. Mark it correct as you see the impact.
Kind regards
Danny Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2016 12:50 AM
var answer = [];
var approver = new GlideRecord("u_managers");
var liststr = current.variables.manager;
approver.addQuery('u_user_name','=', liststr);
approver.query();
while(approver.next()){
answer.push(approver.u_user_name);}
its not working any way .
what can be the problem?
i made a different table but then also its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 05:16 AM
I hope to make this clear by using an image to show the three components used. (see attached image) this might make it easier to grasp.
The field mu_approver is a reference field . Top left of the image is the workflow , middle right of the image is the workings inside the approval user object (in the workflow) and bottom left of the image is the catalog item with the variable that is used in the workflow.