Flow designer - approval request is sent to departments VP or Vice President
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 09:42 AM
Hello,
I am trying to create a flow where the approval request is sent to users Vice President. I tried using the dot walking for manager manager but the the companies organizational chart is not that clear.
I tried scripting but I'm not the best at it.
My script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 10:37 AM
Hi @Wyatt Fudal1 ,
its expecting a string like this, if you look at your first screenshot
try this:
answer = [];
var userTitle=gs.getProperty("user_title_for_approval");
var gr = new GlideRecord("sys_user");
gr.addQuery("Vice President", "CONTIANS", userTitle);
gr.query();
while (gr.next()) {
answer.push(gr.getUniqueValue());
}
return 'ApprovesRejectsAllZ['+answer+']'
//answer has array of VP sys_ids
//it should format something like this
//ex: return 'ApprovesRejectsAllZ[0a826bf03710200044e0bfc8bcbe5d7a,71826bf03710200044e0bfc8bcbe5d3b,etc....]'
Hope this helps!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 11:09 AM
Hello Henanth,
I put the script in but I'm receiving this error 'There was an error executing the flow:Internal Server Error. Exception while executing request: null'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 12:46 AM
Hi @Wyatt Fudal1 ,
Can you share screeshots if its ok, did you try execute your script in the backend script just to make sure returnuing correct output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 11:10 AM
Hello Hermanth,
I did not try to execute script in the background. Should I try if gs.hasTitle or gs.getUserTitile?
Thank you