Record producer is not linking the variable set

Gurpreet Kaur5
Tera Expert

Hi 

There are 2 issues that i am experiencing -

 

Issue 1: 

I have created my first record producer called Log an incident.

I linked the basic information like caller, mobile phone, line manager etc. using Variable sets. 

On the front end, it is working perfectly fine, however when the ticket is logged, it did not pull the user details in the incident (backend)

 

Front end - 

GurpreetKaur5_0-1702477838728.png

 

Backend - 

GurpreetKaur5_1-1702478005514.png

 

2nd issue - again its linked with the same record producer, I mapped the category and subcategory, and it is working perfectly fine on the front end, however at the backend it is not pulling the data. 

 

GurpreetKaur5_3-1702478140434.png

 

can you please advise how to link the variable set  and the variable so it will be pull the data at the backend?

 

Thanks in advance!

 

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Gurpreet Kaur5 

 

Check the code which is OOTB. 

 

var isMobile = gs.isMobile();
var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript:gs.user_id()%5EEQ' : 'home.do';

var linkLbl = isMobile ? "List" : "Homepage";
var br = '<br/>';
var linkURL = '<a href="' + link + '">' + gs.getMessage(linkLbl) + '</a>';
var msgArgs = [br, linkURL];

var info = gs.getMessage("This incident was opened on your behalf{0}The IT department will contact you if they need any further information{0}You can track status from this {1} {0}", msgArgs);

gs.addInfoMessage(info);
var caller = gs.getUserID();
var parent_table = RP.getParameterValue('sysparm_parent_table');
if (global.JSUtil.notNil(parent_table)) {
    var parent_map = new GlideRecord('request_parent_mapping');
    parent_map.addQuery('parent_table', parent_table);
    parent_map.query();
    if (parent_map.next())
        var requested_for_field = parent_map.getValue('requested_for_field');
    var parentGR = new GlideRecord(parent_table);
    parentGR.addQuery('sys_id', RP.getParameterValue('sysparm_parent_sys_id'));
    parentGR.query();
    if (parentGR.next())
        caller = parentGR.getValue(requested_for_field);
}
current.contact_type = 'self-service';
current.caller_id = caller;
var prodCommentStr = producer.comments + "";
if (prodCommentStr.length > 80)
    current.short_description = prodCommentStr.substring(0, 80);
else
    current.short_description = prodCommentStr;
current.description = prodCommentStr;

var incRPUtil = new LinkRecordProducerToIncident();
incRPUtil.linkRecordProducerToParentIncident(RP.getParameterValue('sysparm_parent_sys_id'), current);

https://INSTANCENMAE.service-now.com/now/nav/ui/classic/params/target/sc_cat_item_producer.do%3Fsys_id%3D3f1dd0320a0a0b99000a53f7604a2ef9%26sysparm_record_target%3Dsc_cat_item_producer%26sysparm_record_row%3D1%26sysparm_record_rows%3D2%26sysparm_record_list%3Dpublished_refISEMPTY%255Esys_class_name%2521%253Dsc_cat_item_composite_producer%255EnameSTARTSWITHcreate%2Bi%255Esc_catalogs%253DNULL%255EORsc_catalogsDOES%2BNOT%2BCONTAIN0b22fd2ad7021100b9a5c7400e610319%255EORDERBYorder
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Gurpreet Kaur5 ,

 

to which table u have linked your record producer?

The reason for not being mapped to the backend is the variables created under variable set have diff backend name due to which it will not automatically map to the backend.

 

You need to write a script in your record producer section something like this to map values in backend.

 

current.caller = producer.who_is_thi_request_for; // please use proper backend names of the field

 

Thanks,

Danish

 

Hi Danish,

 

As suggested, i added a script in my record producer section.  The first issue is resolved where the variable set was not mapping the user details (name, email address, mobile number etc.)

however 2nd issue is still not resolved. When i click on Business Service and Configuration items, it is showing none at the front end portal- 

GurpreetKaur5_0-1702485547338.png

 

Backend configuration is - 

GurpreetKaur5_1-1702485635010.png

 

GurpreetKaur5_2-1702485716446.png

 

 

 

 

Hi @Gurpreet Kaur5 ,

 

None as in when u click on it u r not able to see the data?

 

If yes plz check with whichever user u trying to check whether that user has Read access to the Configuration item table or not.

 

For business service I believe we are suppose to lookup at different table rather than incident. cmdb_ci_service

 

Thanks,

Danish