- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 04:21 AM
Hi All,
I'm trying to create a GlideRecord which looks for a unique value in a table to retrieve the Category, Subcategory and Assignment Group on our Incident form via the Service Portal.
I've created the below in the record producer script:
more_details_answer is a field that gets populated with an answers value via a client script. This value then matches a value in the u_csm_question_answer_value field in the table u_assignment_group. This table also holds the category(u_category), subcategory (u_subcategory) and assignment group (u_assignment_group) - all 3 of these are reference fields.
I want to grab the details from these 3 fields and then populate them on the Incident form.
I'm very new to scripting so any help with where I have gone wrong with the above code and also any tips on how I can debug things easier myself will be greatly appreciated.
Thanks
Sam
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 04:26 AM
in line 52 instead of using if(com.next()){
use
if(ans2.next()){
Other part of script looks good.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 04:26 AM
in line 52 instead of using if(com.next()){
use
if(ans2.next()){
Other part of script looks good.
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 05:03 AM
Cheers for that, works a treat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 06:17 AM
I've got a second query off the back of the above code (corrected the error on line 52).
if there is no value in producer.more_details_answer, then it is looking in the table for no value in the u_csm_question_answer_value field.
How is the best way to change the code to not run if producer.more_details_answer has no value in it?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 08:03 AM
Before the GlideRecord query(line 48) add an if statement like :
if(producer.more_details_answer !=''){
and close the if statement after line 61 using }