Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Variables present in Question Table of a request is not appearing in the portal

Anirban3
Tera Contributor

Hello All,

 

I have created a request from a workflow and through script I have put the variables in the "question_answer" table. It is working as expected in the backend as its showing the variables in the request

Anirban3_1-1683126766402.png

 

But, when accessing the request in portal, under "Request Details" it is not displaying the variables and showing as "

There are no variables associated" 

 

Anirban3_0-1683126732599.png

Can someone help me with this?

 

Regards

Anirban

 

 

2 REPLIES 2

rishabh katari1
Mega Guru

Hi @Anirban3 

 

Can you share your workflow image so that I can understand the problem better

Hi Rishabh,

 

Please find the below code. We have a custom table on creation of the record in the custom table through record producer then the RITM should be created

 

var item = gs.getProperty('x_hclan_gbs_financ.mdm_item'); //Record Producer "Create new and Update/Modify Location in Service Now"

var database = new GlideRecord('x_hclan_mdm_request');
database.initialize();
database.setValue('item', item);
database.setValue('source_system', "Saturn");
database.setValue('parent', current.number);
database.setValue('short_description', "Create new and Update/Modify Location in Service Now");
database.setValue('opened_by', current.opened_by);
database.setValue('requested_for', current.requested_for);
database.comments = "MDM Request created from " + current.number;
database.insert();
current.parent = database.number;
current.description = "Comment: " + current.description + "\n Request created: " + current.parent;

var comments = '';


var producerVars = new GlideRecord('question_answer');
producerVars.addQuery('table_sys_id', current.sys_id);
producerVars.query();
while (producerVars.next()) {
if(producerVars.value)
{
var gr = new GlideRecord('question_answer');
gr.value = producerVars.value;
gr.table_sys_id = database.sys_id;
gr.table_name ='sc_req_item';
gr.question = producerVars.question;
gr.order = producerVars.order;
gr.insert();
}
}

 

Regards

Anirban