Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I add an incident number and short description to the Survey?

jackiem
Kilo Contributor

Hello,

I am trying to add the incident number and short description to the survey.   I can add the incident number to the email but I would like it to appear directly within the survey take page.    

I found one suggestion to pass the parameter of the incident number through the URL and default the value of a question on the survey to javascript:RP.getParameterValue("incidentnum") but I do not see a field for the default value of a question. I could find the field in the legacy survey but not under the new surveys in Fuji.  

How do I add the incident number and description into either the survey intro or somewhere on the survey take page?

thank you,

Jackie

1 ACCEPTED SOLUTION

My apologies Jackie - I just assumed that survey was a system delivered UI page since it sounded like it was. I looked at ours a little closer - survey was a page we created based off of assessment_take2 (so that we would not lose the future updates). The code above was put inside this tag: <div class="assessment">, you can play with it to get it in the right spot on the page.


View solution in original post

30 REPLIES 30

TrevorK
Tera Guru

Here is our code. I apologize in advance if I missed a tag to close it while copying it out, but I am sure you get the idea:


<g2:evaluate var="jvar_record"


                expression="var recordGR='';


                                          gs.log(instanceGR.trigger_table + ' ' + instanceGR.trigger_id);


                var recordGR = new GlideRecord(instanceGR.trigger_table);


                recordGR.addQuery('sys_id', instanceGR.trigger_id);


                recordGR.query();              


                " />


                                          <j2:if test="$[typeof recordGR == 'object']">


                                              <j2:if test="$[recordGR.next()]">


                                                  <div style="margin-bottom:0px;"><b>Incident number:</b>


                                                      $[recordGR.number]


                                                  </div>


                                                  <div style="margin-bottom:0px;"><b>Description:</b>


                                                      $[recordGR.short_description]


                                                  </div>


                                                 


                                              </j2:if>


                                          </j2:if>


                                         



This of course modifies the survey UI pages (the page is called survey), so I assume if there are future updates to this UI page from ServiceNow you'll have to manually apply them/revert to original and apply them. If that makes no sense to you I can explain it further.


jackiem
Kilo Contributor

Hi Trevor,



Thank you for your response.     What you have makes sense but I am not 100% sure where to add the code.   I looked under the UI pages and did not find one called just "survey" but I found one called suvey_take and was wondering if that would be the page which I need to modify?



Did you add this under the client script section?   (sorry, still fairly new to ServiceNow.     I have only recently ventured into the scripting within ServiceNow).



I appreciate your help.


My apologies Jackie - I just assumed that survey was a system delivered UI page since it sounded like it was. I looked at ours a little closer - survey was a page we created based off of assessment_take2 (so that we would not lose the future updates). The code above was put inside this tag: <div class="assessment">, you can play with it to get it in the right spot on the page.


jackiem
Kilo Contributor

Hi Trevor,



Thank you sooooooooo much!! That worked like a charm.



I would not have been able to do this without you.   Thank you for taking the time to answer my question and then provide additional steps.   I apprecaite your help.



Thank you!!!