I'm porting existing js functions to apigee. One of the functions is constructed similar to what is shown below in the getRoles() which takes a function as a parameter
In the below function, when running on apigee nothing appears to be evaluated after var userX declaration. This function is skipped and the next is evaluated.
Is this a problem with the syntax or I need to refactor into seperate functions without nested declarations?
function build_my_stuff(config) { var userN = "xxxxx"; var userP = "yyyyyy"; var device = "rrrrrrr"; var userX = "pppppT"; getRoles(userN, config, function(titles) { var things = { xyz : "GUESS", tuv : userN, rty : userP, uio : device, roles : titles, attrs : { dev_id : device, user : userX } }; dothis (things, config); }); }
Solved! Go to Solution.
The syntax you are using looks fine.
But whether it operates the way you expect depends on what happens in getRoles().
Asynch JavaScript won't work in a JavaScript callout.
What is getRoles? The JS callout will not "wait" for the callback you pass to getRoles , to be called.
The syntax you are using looks fine.
But whether it operates the way you expect depends on what happens in getRoles().
Asynch JavaScript won't work in a JavaScript callout.
What is getRoles? The JS callout will not "wait" for the callback you pass to getRoles , to be called.
Thanks, it was an asynch. call I will have to refactor to use httpclient.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |