- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2020 10:00 AM
I have a record producer that creates a data_source record, but I also want to create a problem ticket under certain circumstances. I accomplished this in the Record Producer's script section. Simplified code:
if(producer.u_type == 'Create Problem'){
var prob = new GlideRecord('problem');
prob.initialize();
prob.short_description = "Data Source Request";
prob.due_date = producer.u_due_date;
var probId = prob.insert();
}
However, I needed the user to be able to select data from a dynamic slush bucket, so I embedded a ui page onto the record producer. It has the following fields (simplified):
<input type="text" id="test_field" onchange='populateSlushbucket()' />
<g:ui_slushbucket id='slush' >
</g:ui_slushbucket>
So my question is this: Back in the record producer script, how do I access the values from the UI Page fields? I can get the producer fields easily enough with "producer.u_field_name," but I don't get anything using "producer.u_ui_page."
I need to include the values from both the text and slush fields on the problem ticket.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2020 08:15 AM
Hi,
you cannot access the UI page value inside record producer script directly.
One thing you can use is this approach
1) create a variable on record producer which is string type such as users
2) in the UI page client script code you can then set the value of that variable using g_form.setValue('users', values)
3) Now you have the sys_ids in that variable you can use that in record producer script
current.<fieldName> = producer.users;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2020 08:15 AM
Hi,
you cannot access the UI page value inside record producer script directly.
One thing you can use is this approach
1) create a variable on record producer which is string type such as users
2) in the UI page client script code you can then set the value of that variable using g_form.setValue('users', values)
3) Now you have the sys_ids in that variable you can use that in record producer script
current.<fieldName> = producer.users;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 07:36 AM
Brilliant! Thank you Ankur!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2020 07:57 AM
You are welcome
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader