- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 10:15 AM
Hi,
I am trying to figure out the mistake on this script. But no luck.. I am totally new to scripting, hence couldn't figure out where it has gone wrong.
Scenario:
While submitting Record producer, it has to get assigned to the group as per the sub category selection.
sub categories are select box variables in a variable set. Below is the script I have used.
*sub_category is the variable name which is a 'Select box'
*Info/data is one of the value in the select box
var sc = producer.sub_category;
if (sc == 'Info/data') {
current.assignment_group = 'e333f746974c611004d4fef3a253af92';
} else {
current.assignment_group = 'fd537fc2974c611004d4fef3a253af14';
}
while submitting the record producer, it is getting assigned to the group in else statement irrespective of the values I am selecting from the select box. If condition is not working.
Also I don't know how to check if the variables are passing through the conditions properly, like alert or something else.
Any help would be highly appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 10:27 AM - edited ‎01-04-2023 10:27 AM
A very simple test would be to just do a "gs.addInfoMessage('my sub category: ' + producer.sub_category);" in your producer script. Do a "Try it", fill the values and submit - it should now show on top of the page what the value is. Then you can do your debugging from there. Sounds like as soon as you know the exact value you will be just fine 🙂
Best regards,
Sebastian Laursen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 10:27 AM - edited ‎01-04-2023 10:27 AM
A very simple test would be to just do a "gs.addInfoMessage('my sub category: ' + producer.sub_category);" in your producer script. Do a "Try it", fill the values and submit - it should now show on top of the page what the value is. Then you can do your debugging from there. Sounds like as soon as you know the exact value you will be just fine 🙂
Best regards,
Sebastian Laursen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 01:53 PM
Hi Sebastian,
Thank you for the response. This solution gave me the response as 'my sub category: 6' which is the value of Info/data in select box list. So I replaced 'Info/data' with 6 and it worked.
Thank you so much for the help!!
SM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 11:14 AM
In addition to what Sebastian mentioned, you can also add a gs.info(); line in your code.
Something like gs.info('SM10 sub category: ' + sc);
Then go to logs and in the message, search on SM10 so you only see your results.
Also, add .toString() to your variable like this: var sc = producer.sub_category.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2023 02:01 PM
Hi Matthew,
Thank you for the response. Your message tells me I need a lot to study to move forward.. 🙂
Could you please guide me on how to check logs. Is that system log -> All ?
I checked that part and in the message searched with SM10, but couldn't get much details.
PS:- I am currently working on Application scope: Customer Service