Update Incident Number and other incident information on Survey Page
You can update incident number as well as other incident information on your survey page.
Note: This is not only related to incident, you can even update your custom table information over the survey page.
Few things you need to change
- You need to write jelly code in "assessment_take2" UI Page.
- Add UI page client script variable in your survey introduction field.
Here you go..
UI Page:
System UI >> UI Page >> search for "assessment_take2"
- Add Jelly script in html section.
Kindly add the script before the starting of g2:evaluate tag. refer the screenshot below.
var gr = new GlideRecord("asmt_assessment_instance");
gr.get(instance);
var task_record = "";
var task_table = "";
if(gr.trigger_table){
var tr = new GlideRecord(gr.trigger_table);
if(tr.get(gr.trigger_id)){
task_table = tr.getClassDisplayValue();
task_record = tr.getDisplayValue();
}
}
task_record;
var gr = new GlideRecord("asmt_assessment_instance");
gr.get(instance);
var inc_cat = "";
if(gr.trigger_table){
var tr = new GlideRecord(gr.trigger_table);
if(tr.get(gr.trigger_id)){
inc_cat = tr.category.getDisplayValue();
}
}
inc_cat;
- Adding html hidden field to save the variable value. here we need to add the html field in tag
Note: The tag is used to evaluate an expression written in Rhino JavaScript and sometimes to set a variable to the value of the expression.The last statement in the expression is the value the variable will contain.
<!-- added one hidden html field -->
- In UI Page there is one section called client script ,there you need to mention the client script. the value we had saved in html field need to get into client script then we will use that variable in survey page.
gel('task_record_sys_id123').innerHTML += gel('task_record_sys_id').value;
gel('task_record_sys_id1234').innerHTML += gel('task_record_sys_id1').value;
- Open your survey that you have build. just for the testing i am going to make the changes in OOTB survey "Change Request Satisfaction Survey". there is one field called Introduction, here we will save the variable that had mentioned in your ui page client script.
Note: The introduction field is html type of field so kindly click on "source code" (icon will be "<>") button. and paste the code below there.
| Number : | |
| Category : |
Final result:
Please let me know if anyone need some help related to survey.
https://www.servicenow.com/community/in-other-news/update-incident-number-and-other-incident-information-on-survey/ba-p/2278645