Survey validation based on Incident choice field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi Community, good day.
I have a requirement related to surveys on the Incident table. There is a choice field on the Incident form. I need to apply the following behavior when a user opens or submits the related survey:
If the choice field on the Incident is empty:
The survey should show an error message such as:
"Please select a value in the choice field before completing this survey."If the choice field has a value:
The survey should show a confirmation or display text such as:
"Survey for Incident INC123" (using the actual incident number dynamically).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi @DevYadav ,
You can make your question mandatory in the survey to achieve the first one easily. Just refer below screenshot & you can make it mandatory.
But if you want to add a custom error message & also show a popup window once they're trying to submit it you need to do it the hard way by configuring the service portal widgets.
For the first one you can add validation in client controller if data is not present throw an error.
For the 2nd requirement you need to create a modal window using spmodal & display the information before submitting the survey.
Please let me know if you want to proceed in that way so that I can help you with that approach I just gave a high level approach but you need to configure all of the details in widget properly to achieve this.
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards,
Madhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
PFA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
thanks for the response,
in the related links section there is the option for the survey. I just want to change the incident option, and when the record is saved, clicking on the related list generates the survey. So, a message should appear at the top of that survey.
And in the screenshot you shared, please also tell me exactly where you made the changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @DevYadav ,
In that case you can update or change the OOTB related link
Change the Incident related-link UI Action (the link that launches the survey) to pass a short URL parameter indicating the incident number and the choice-field state and update the Survey display (Service Portal survey widget or the survey page) to read that parameter.
Render either the error text or the confirmation text at the top.
Also, the screenshot is from Survey Designer > Questions. Open a survey or questionnaire & click on any question title to edit or land on the above screenshot page.
If my answer has helped with your question in any way, please mark my answer as the accepted solution and give a thumbs up.
Best regards,
Madhan
