Record Producer variable set script

mp_10
Tera Contributor

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

1 ACCEPTED SOLUTION

Sebastian L
Mega Sage

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

View solution in original post

7 REPLIES 7

Yep, you are in the right place. System Log > All

I usually filter on records created in the last 5 minutes to reduce load time.

So the filter would be Created > Relative > after > 5 minutes

 

Hope this helps

ricker
Tera Guru

sm10,

The issue is Value vs. Display Value but...you should use Assignment Rules instead of putting in the RP script and you shouldn't put sys_id's in scripts.

mp_10
Tera Contributor

Hi Ricker,

Thank you for the response!! 

You are right, the issue was between value vs display text. I got the concept now.

I have not tried the Assignment Rules concept yet. I will try to implement the same scenario using Assignment rules too.