display the dependent question on the smart assessment form based on the other table data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2025 05:03 AM
On the smart Assessment form , for one of question user selects the 'next' or 'move' it should check the other table data for that entity has value or not if yes it should show the dependent question if not dependent ques not required
can someone please help on that
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2025 05:09 AM
Hello @harinya
Use below on change catalog client script and Script include. (NOTE TO REPLACE with correct fields)
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue === '') { return; } // Call the Script Include to check the other table data var ga = new GlideAjax('CheckEntityData'); ga.addParam('sysparm_name', 'checkData'); ga.addParam('sysparm_entity', g_form.getValue('entity_field')); // Replace 'entity_field' with the actual field name ga.getXMLAnswer(function(response) { var result = response.responseXML.documentElement.getAttribute('answer'); if (result === 'true') { // Show the dependent question g_form.setDisplay('dependent_question', true); // Replace 'dependent_question' with the actual field name } else { // Hide the dependent question g_form.setDisplay('dependent_question', false); // Replace 'dependent_question' with the actual field name } }); }
Script Include
This script include will check if the other table data for the entity has a value or not.
var CheckEntityData = Class.create(); CheckEntityData.prototype = Object.extendsObject(AbstractAjaxProcessor, { checkData: function() { var entity = this.getParameter('sysparm_entity'); var gr = new GlideRecord('other_table'); // Replace 'other_table' with the actual table name gr.addQuery('entity_field', entity); // Replace 'entity_field' with the actual field name gr.query(); if (gr.next()) { return 'true'; } else { return 'false'; } } });
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2025 02:15 AM
Instead of modifying the progression script. I would suggest to copy the values from the entity to answer the questions so they are not required, you can write a flow to pre-populate answers to questions in Smart assessments so they are not required. Additionally, this can help from an audit perspective to make it clear what the values were when the assessment was done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2025 08:45 PM
Hello @harinya
Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE