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 05:22 AM
Hi @DSV22 ,
Apologies my bad, u need to use only 1 = sign in this line
current.business_service == gr.sys_id;
Can u try by removing the extra equals to line & check if it works
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 05:32 AM - edited 09-11-2024 05:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 07:00 AM
Hi @DSV22 ,
Could u pls log producer.application_affected for me plz & let me know what is coming
Use this
gs.info("Business Service1"+producer.application_affected);
gs.info("Business Service2"+producer.application_affected.getDisplayValue());
Do this logs at the very 1st line before the actual code. Once executed can u then check logs & let me know what is the value coming for both
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 07:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 09:57 AM
Hi @DSV22 ,
Assuming in ur service table u already have the application. Plz try below updated code:
var gr = new GlideRecord('cmdb_ci_service');
gr.addQuery('name',producer.application_affected.getDisplayValue());
gr.query();
if(gr.next()){
current.business_service = gr.sys_id;
}
Thanks,
Danish