
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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.
<!-- update incident Number on survey page -->
<g:evaluate var="jvar_task_record_sys_id">
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;
</g:evaluate>
<!-- update incident category on survey page -->
<g:evaluate var="jvar_task_record_sys_id1">
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;
</g:evaluate>
- Adding html hidden field to save the <g:evaluate> variable value. here we need to add the html field in <g:ui_form> tag
Note: The <g:evaluate> 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 -->
<input type="hidden" id="task_record_sys_id" name="task_record_sys_id" value="${jvar_task_record_sys_id}" />
<input type="hidden" id="task_record_sys_id1" name="task_record_sys_id1" value="${jvar_task_record_sys_id1}" />
- 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.
<p> </p>
<table>
<tbody>
<tr>
<td>Number :</td>
<td id="task_record_sys_id123" style="color: red;"> </td>
</tr>
<tr>
<td>Category :</td>
<td id="task_record_sys_id1234" style="color: green;"> </td>
</tr>
</tbody>
</table>
<p></p>
<p> </p>
Final result:
Please let me know if anyone need some help related to survey.
- 3,612 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.