troubleshoot variable editor

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I'm experience a strange problem. I have a record producer which looks good. Both in the Service Portal and when I press the "try it" button on the RP. But when I look at the record created and the variable editor, it breaks some of the containers when the record is created from the Service Portal, but looks fine when I create it through the "try it".

So my thought is that inside the variables field, there must be more things than only the data which I can get through current.variables.variable_name. Here must be stuff like order etc? and I wanna compare the two record which should have the same information.... Anyone know how to do this or any other approach for this? It is also not only in one RP this happens, but it doesn't either happens to all RPs... But I haven't been able to see any same connections between the working and none working...

Here is an example of a working "variable editor".

right order hydro form.JPG

and one that broken:

wrong order Hydro form.JPG

Any ideas is appreciated .

//Göran

1 ACCEPTED SOLUTION

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I saw that I didn't   update this topic with the solution and thought I might as well.



When a record is created like this, the variables are saved in a table called question_answer. Here you can find records like this:


find_real_file.png



As you can see I had order -100 which is a bug that happens sometimes and that leads to the strange behavior that I got.



You can read about the bug here and atm. there isn't a fix for it.



https://hi.service-now.com/kb_view.do?sysparm_article=KB0610332


https://hi.service-now.com/kb_view.do?sysparm_article=KB0610335



My solution was to create a after BR that fixed the order by looking at the order from the record producer variables and setting it the same here.



(function executeRule(current, previous /*null when async*/) {



/*


This script is to fix the bug where SN would sometimes give variables on the record order -100 when created through


a Record Producer through the Service Portal.


*/



var qa = new GlideRecord('question_answer');


qa.addQuery('table_sys_id',current.getUniqueValue());


qa.query();


while(qa.next()){


  qa.order = qa.question.order;


  qa.update();


}


})(current, previous);


View solution in original post

3 REPLIES 3

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I saw that I didn't   update this topic with the solution and thought I might as well.



When a record is created like this, the variables are saved in a table called question_answer. Here you can find records like this:


find_real_file.png



As you can see I had order -100 which is a bug that happens sometimes and that leads to the strange behavior that I got.



You can read about the bug here and atm. there isn't a fix for it.



https://hi.service-now.com/kb_view.do?sysparm_article=KB0610332


https://hi.service-now.com/kb_view.do?sysparm_article=KB0610335



My solution was to create a after BR that fixed the order by looking at the order from the record producer variables and setting it the same here.



(function executeRule(current, previous /*null when async*/) {



/*


This script is to fix the bug where SN would sometimes give variables on the record order -100 when created through


a Record Producer through the Service Portal.


*/



var qa = new GlideRecord('question_answer');


qa.addQuery('table_sys_id',current.getUniqueValue());


qa.query();


while(qa.next()){


  qa.order = qa.question.order;


  qa.update();


}


})(current, previous);


Daniel Peel
Mega Sage

I wanted to post.. that in Madrid Patch 6 this is still an issue.  A record producer submitted via an Order guide... still has issues with Order on the variable editor.  This business rule worked great! 

I didn't find -100's but they order does not match what you set and sometimes re-orders them entirely or leaves the order blank

Thanks

Arinton
Giga Contributor

Well, this is not the simplest business and companies that have weak portfolios should not be trusted. So in this case, I looked through all the above and realized that if there really would be a difficult task, then they could not cope with it. Especially if you need to develop mobile app or web app from scratch, then I would entrust this work only https://tech-stack.io/