
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 04:49 AM
Hi Everyone
Can somebody help me with the Javascript below?
I have three variables on the record producer: category, sap_application, tor_infrastructure
When the user selects in category SAP than he can choose from the variable sap_application the related SAP Module. The same for the other variable.
Everytime the record producer is executed it runs through the outer default statement: gs.log("inside last default");
Or is there a better way to achieve this? I think I can't use assignment rules on a record producer?
Thank you very much
Christina
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 06:53 AM
This is an old thread, but I just ran into this issue and its resolution.
It appears that the variable type is not a string when getting the value from the producer variable.
EX:
var x = producer.u_variable_name; //Not a string
So if you convert to a string:
var x - producer.u_variable_name.toString(); //Is a string
it will resolve the issue and the Switch will work as intended.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 06:49 AM
Hi Christina,
I don't see anything that jumps out at me that's wrong here. I would just check your case values to make sure that they match the both the value and type of your field.
That being said, you should be able to use assignment rules with this. Whether your incident is created manually, through an inbound action, or through a record producer in your case you should be able to run assignment rules assuming the the assignment group field is blank when the incident gets created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 06:56 AM
Hi Brad
Thanks for your input. As far as I checked (for the sap_application and tor_category variable) the variables are set correctly. But it's not jumping in the right case in the switch statement.
Am I able to make assignment rules on the values of record producer variables? Because the information for the assignment is only in the variables of the record producer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 06:59 AM
Hmm...you'd have to write those values to the incident form somewhere to use the assignment rules.
Another option you might try is creating an assignment lookup table for the RP to use when assigning the incident in the RP script. It's really not a great practice to have some many sys_ids hardcoded in a record producer (that may skirt the fine line between best practice and just my preference though). If you have a lookup table you can define all of the relationships there and just do a gliderecord query to assign based on the relationship. It may seem like overkill now, but if that assignment grows it all it could become pretty unwieldy in the RP script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 07:04 AM
I haven't used JSUtil before but looking at the wiki, it looks like you need more to your statement:
if (JSUtil.nonNil(producer.sap_application) = '');