- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2020 11:39 AM
Maybe someone can help me out there.
I am currently working on a catalog item that needs to send an approval if any user inside a members list-collector box belongs to the CORP or ASSET department. Otherwise, not approval is needed.
To achieve that, I created a hidden yes/no variable in the form, to then pass the true/false value returned by a AJAX script include, as shown below. Thing is that it always returns ‘false’. Maybe someone can tell me what it is I am doing wrong, or maybe there is a better and easier approach to it.
I am not sure if I need to use the right bucket suffix in the onSubmit client script below.
Script Include:
onSubmit Client Script:
-------------------------------------------------------------------------------------------------------
Thanks,
Juan
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2020 09:47 AM
Thanks a lot Stefen for the good advice.
I used the gs.log() to track the variable values, and I was able to get the script include returning the correct value. It is a very helpful tool.
The only issue I have now is that the setValue() function does not seem to work when called from within a callback() function inside the onSubmit script. It never updates the cat item variable. It seems to be that it tries to update it after the onSubmit function takes effect.
Maybe someonw out there knows how to update the variable from within the onSubmit client script. I heard that using a Promise should do it, but I am not an advansed Java programmer.
Alternatively, I tried updating the approval_needed var from within the onChange script, but I have problem updating/refreshing its value when adding/removing users on the List Collector variable. I just need to make sure the approval_needed var has a true value, as long as there is a user in the List Collector box who happens to be a member of the CORP or ASSET dept. I noticed that adding users from other departments changes the value to false, which defeats the purpose.
Thanks,
Juan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2020 11:53 AM
Hi,
You should only return true or false and not like you are doing now.
Use this:
return true;
else return false;
Thakns,
Ashutosh