The CreatorCon Call for Content is officially open! Get started here.

Scripts possibility in Smart Assessment Engine

guthikondav
Tera Contributor

Hi Community,

 

We are having a requirement that, need to create an assessments on controls table(sn_compliance_control) using smart assessment engine. I have created the templates and questions in the assessment workspace.

My query was: How we can add the script logics. for example, we can auto-populate the data on catalog form/record producer using onload client script with script include functionality.
I want to build same type of questionnaire template. when assessor(control owner) selects the control number in the reference question, need to auto-populate all the controls data, risks, owner information and other test plans on the template form.
How we can build this scripts scenario in smart assessment engine please let me know.
I am new to this smart assessment engine functionality, need your help and guidance to progress on my requirements(I know script include with form client script, but same logic how can i apply here with SAE).

Please guide me any one.
Thankyou.

7 REPLIES 7

Vinod54
Tera Expert

Hello @guthikondav , @Lokesh5 ,

 

You can make use of the scripting part within the automate response using below steps. 

1. Set Editable to false
2. Use the questionInstanceId variable within the script, get the assessment instance.
3. Perform your scripting in the inline script or you can also leverage script include or flows
4. Finally set the required result to result.value variable. 

ServiceNow Releavant Reference

Thanks,

Vinod Kumar M

ServiceNow Architect


Mark it helpful and Solution Accepted, if the response helped you. 

Lokesh5
Tera Contributor

Hello @Vinod54 

 

Thanks for your response. 

I wanted to check if there is a way to configure question behavior such that the available choices in the second question are dynamically limited based on the response selected in the first question.

 

For example, if a user selects a particular response in Question 1, the visibility of choices in Question 2 should automatically adjust and only display the relevant options. Ideally, this should happen through an 'Onchange' functionality.

Could you please confirm if this functionality is supported, or if there is an alternative approach to achieve this?

guthikondav
Tera Contributor

@Vinod54  Hi Vinod, thanks for the reply.
We can able to retrieve questionInstanceId variable within the script and can get the assessment instance.
We can perform the script logit and assign the result to result.value variable.

For example, Iam having 10 fields need to populate using Control filed (Reference) selection.
result.value can hold only one result value, how we can add this to 10 fields.
In Client-callable Script Include - Onload client script we will add the JSON results to our required filed to autopopulate.
But here in smart assessment result.value variable can hold one value. 
Do we need to define automate response script logic to each question ?

How we can handle cross-scope functionality in smart assessments ? Please let me know.