Need to pass the Dynamic UserId as Input in terms of string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:32 AM
Hello @Ankur Bawiskar / @Brad Bowman
This is regarding the execution of one of the ACTION in flow designer. I am executing the flow action using Onchange client script
I am successfully able to execute the action via catalog client script but receiving one of the error when passing the Userid as a input for the flow action.
I need to pass this Userid based on the selection of the requested for on the catalog form.
When I am giving the hard coded value for the UserId then client script and action execution is successful but when I am giving the dynamic value of the UserId based on the value in the requested for on the catalog.. then script and action execution is not successful.
Please see the below code.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue != '') {
(function() {
g_form.getReference('requested_for', getUser);
var inputs = {};
inputs['userid'] = userID; // string
GlideFlow.startAction('abc', inputs)
.then(function(execution) {
return execution.awaitCompletion();
}, errorResolver)
.then(function(completion) {
var status = completion.status;
// Available Outputs:
var outputs = completion.outputs;
var result = outputs['result']; // String
g_form.addInfoMessage(result);
});
function getUser(caller) {
var userID = caller.user_name;
}
function errorResolver(error) {
// Handle errors in error resolver
}
})();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:35 AM
Hi @Rahul84
Where have you declared the userID, it seems you are directly using it without declaring it.
Declare userID = " "; then use the below code.
inputs['userid'] = userID; // string
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:45 AM
function getUser(caller) {
var userID = caller.user_name;
}
declared in the function and I am getting the correct userid based on the requested for on the catalog form..
not sure why it is not taking as inputs..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:49 AM
Hi @Sagar Pagar ,
I have already declared that in another function , pls check the code once and i m getting the correct value for it as well but it is not taking that UserID as string as input .
also can you suggest the code for glide ajax call to get user id but user id I am getting ..
the only thing is it is not allowing to send as string in inputs
g_form.getReference('requested_for', getUser);
var inputs = {};
inputs['userid'] = userID; // string
function getUser(caller) {
var userID = caller.user_name;
}