Record producer fields mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 03:12 AM
Hi team,
I have 3 fields in record producer to map with the 3 fields with incident form which I have done.using the script
current.business_service = producer.field_name;
current.category= producer.field_name;
Category field is taking the backend choice value and the Business services field is not taking any value since it is a reference field in the incident form
Can anyone please suggest how to achieve this task to populate the exact values which is selected while submitting the form.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 03:29 AM
Hi @DSV22 ,
What are the types of field on your Record producer. Possible to share a snip would be great.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 03:33 AM
Hi @Danish Bhairag2,
These are RP variables
I want to populate these in the category and services field in the incident form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 04:30 AM - edited 09-11-2024 05:22 AM
Hi @DSV22 ,
As i could see the type of both the fields are select box. Also as we know when its a reference field in servicenow it only accepts sys id to populate the record so in that case what u need to do is, in the producer script section before doing this
current.business_service = producer.field_name;
we will 1st fetch the sys id of that application from the corresponding table.
var gr = new GlideRecord('cmdb_ci_service'); // Assuming this is the table mapped at your end as well on Inicident form
gr.addQuery('name',producer.application_affected);
gr.query();
if(gr.next()){
current.service = gr.sys_id; //u can replace with the backend field name from incident form (current.field_name)
}
for category u need to make sure whatever choices u have created under the field of Issue type the same choices are also available on the incident form category field. If its not present it will not map the display value it will map the Backend value. Also use below command to map the category value.
current.category = producer.issue_type.getDisplayValue();
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 04:48 AM - edited 09-11-2024 04:48 AM
Hi @Danish Bhairag2 ,
For the issue type it is working but for service field it is not working