How to add a dynamic reference field in questionnaire Survey?

Arun_Manoj
Mega Sage

Hi,

 

I need to add a dynamic reference field in Survey questionnaire , auto populate  REQ number in the survey questionnaire.

 

 

Thanks

 

4 REPLIES 4

cloudops
Tera Expert


Sure, here are the steps to add a dynamic reference field in a Survey questionnaire and auto-populate the REQ number:

1. Navigate to the Survey Designer:
- In the ServiceNow filter navigator, type "Survey Designer" and select it.

2. Open the Survey where you want to add the dynamic reference field:
- Click on "Open" and select the survey from the list.

3. Add a new question to the survey:
- Click on "Add Question" button.
- In the "Question" field, type your question.
- In the "Type" field, select "Reference".
- In the "Table" field, select the table where the REQ number is stored (usually, it's the "Request" table).

4. To auto-populate the REQ number, you need to create a UI Policy:
- Navigate to "System UI > UI Policies".
- Click on "New" to create a new UI Policy.
- In the "Table" field, select the "Assessment Instance" table.
- In the "Short description" field, type a description for your UI Policy.
- Click on "Submit" to save the UI Policy.

5. Add a UI Policy Action to auto-populate the REQ number:
- Open the UI Policy you just created.
- In the "UI Policy Actions" related list, click on "New".
- In the "Field name" field, select the reference field you added to the survey.
- In the "Value" field, type the script to auto-populate the REQ number. You can use the "g_form.getValue()" function to get the REQ number from the current record.

Gopi5
Tera Contributor

I am in need of pulling information from a table to the assessment form as informational and trying to follow the steps.
Could you clarify the "Value" field, where do I find that?
Is there additional scripting to be done other than using the g_form?

Gopi5
Tera Contributor

To update a field to the header of assessment, the widget needs to be updated as adding a reference field and coding a script did not work.
This is the link that would get you to the widgets, just need to update the xxxxxxx with your instance name.

https://xxxxxxx.service-now.com/nav_to.do?uri=sp_widget.do?sys_id=869baae273fc10100d72a56a4cf6a72c

Hi,
This link doesn't work. Can't view the widget. Can you please add more details as in the name of the widget and what needs to be changed. 
Appreciate your help!