Smart Assessment- I have created one smart assessment and want auto populate the control fields

Mounika_p
Tera Contributor

Smart Assessment- I have created one smart assessment and In that one section named

1."control"(read only) want auto populate the control fields ,name , description ,entity these details shlould autopopulate.

2"control"(editable) --this section should be editable and user who is taking the assessment should enter the values. 

Is it poossible to configure ? I have created first section but not getting idea where to give condition or script to auto populate the details

1 REPLY 1

Yogesh11bhatt
Tera Expert

Hi Mounika,

You can definitely configure this in the Smart Assessment Engine! Standard form client scripts don't apply the same way here, but you have two great paths to handle this—one scripted and one Out-of-the-Box (OOTB) no-code.

Method 1: Server-Side Scripting via "Automate Response"

If you absolutely need these fields to be mapped as read-only questions within the assessment body itself, you can use the Automate Response configuration.

  1. Open your read-only question (e.g., the "Entity" question) in the Assessment Workspace.

  2. Check the Automate response box and select the Scripting option.

  3. You will have access to two built-in parameters: questionInstanceId and result.value.

Here is a script snippet you can use to query the target record and pull the values:

JavaScript
 
// Query the question instance table
var questionGr = new GlideRecord('sn_smart_asmt_question_instance');
if (questionGr.get(questionInstanceId)) {
    
    // Dot-walk to the assessment instance to get the source record (e.g., Control)
    var asmtInstance = questionGr.assessment_instance.getRefRecord();
    
    // Fetch the target record the assessment is running against
    // Note: adjust 'target' to match your specific architecture's reference field
    var targetRecordGr = asmtInstance.target; 
    
    if (targetRecordGr) {
        // Set the output for this specific question
        result.value = targetRecordGr.getValue('name'); // Change to 'description' or 'profile' as needed
    }
}

Note: If the auto-population needs to change dynamically based on another question's input within the assessment, ensure the Set response as editable option is configured under additional options so the script triggers onChange.

Method 2: The "Assessment Reference" Scope (Recommended Architecture)

To keep the upgrade path clean and avoid unnecessary server queries, a much better architectural approach is to use Assessment References.

Instead of building custom read-only questions, you can display fields like Entity, Description, and Control Name natively in the contextual side panel for the assessor.

  • Ensure the property sn_grc_case_mgmt.enable_smart_assessments is enabled in your instance.

  • Configure the Scope of the template to include the specific fields you want the user to see.

  • These will appear alongside the editable questions in Section 2, keeping the core questionnaire clean and performant!

Please mark this response as helpful if it guided you in the right direction.