Show Dependent question

harinya
Tera Contributor

Hi,
can someone please help i need to show one dependent question when it's above question was answered as partial/complete, that system needs to check other table data( central table asset field has specific value) in smart assessment form please help i am new to GRC

13 REPLIES 13

Hi @harinya ,

Within the Assessment Workspace designer, you can only make questions conditionally visible based on other questions. So you could show your question if the answer to a previous question is Partial or Complete. But not based on a table lookup; which is what I'm assuming you're wanting for question 2.

 

Question visibility is set via the additional attributes menu

KieranAnson_0-1744001108811.png

 

Thanks for Response , yes we can show a question based on previous answers but here we need to check the other table data, i have tried with created a text question and using the automate response trying to create the script seems that also not working 
will it work please help
by gliding the business app table and central solution table

harinya
Tera Contributor

try {

} catch (error) {
gs.error("Error in Automated Response Script: " + error.message);
return false; // Return false in case of errors
}

@harinya 

then it's not possible to call any script include etc

You can simply show/hide based on previous survey questions.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

HI @Ankur Bawiskar  , @Kieran Anson 
Can you please help to glide the table central solution table data and that Asset value is onboarded or not

try {
// Step 1: Query the Central Solution Table
var centralSolutionGr = new GlideRecord('central_solution_table'); // Replace with the actual Central Solution table name
centralSolutionGr.query();

while (centralSolutionGr.next()) {
// Get the asset field from the Central Solution Table
var asset = centralSolutionGr.getValue('asset'); // Replace 'asset' with the actual field name

if (asset) {
// Step 2: Query the Business Application Table using the asset as the Instance ID
var businessAppGr = new GlideRecord('business_application_table'); // Replace with the actual Business Application table name
businessAppGr.addQuery('instance_id', asset); // Replace 'instance_id' with the correct field name in the Business Application Table
businessAppGr.query();

if (businessAppGr.next()) {
// Found a match: Business Application Instance ID matches Central Solution Asset
gs.info('Match Found: Central Solution Asset = ' + asset + ', Business Application Instance ID = ' + businessAppGr.getValue('instance_id'));

// Step 3: Check if the asset is "Onboarded" and update the created text field
if (asset === 'Onboarded') {
centralSolutionGr.setValue('created_text_field', 'Asset is Onboarded'); // Replace 'created_text_field' with the correct text field name
centralSolutionGr.update(); // Save the record with the updated value
gs.info('Updated created text field for Central Solution Asset: ' + asset);
}
} else {
// Log if no match is found in Business Application Table
gs.info('No match found for Asset: ' + asset + ' in Business Application Table');
}
}
}

} catch (error) {
// Log any errors for debugging purposes
gs.error('Error in script: ' + error.message);
}
will this work