- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 02:13 AM
Hi Team,
In the image shown below I wanted to add other details of Incident like short description and priority.
Where I should change I tried in survey widget but getting Error --> surveryAPI() is not declared.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:16 AM
Hi @SandeepKSingh
Open The Widget "My Survey"
And you need to clone the widget before do any changes.
Then Just add the below code in Server side script and HTML :-
Server Side :-
var triggerId = instance.trigger_id;
gs.info("Trigger ID: " + triggerId);
var incidentGR = new GlideRecord('incident');
if (triggerId && incidentGR.get(triggerId)) {
gs.info("Incident found with sys_id: " + triggerId);
instance.incident_number = incidentGR.getValue('number');
instance.incident_short_description = incidentGR.getValue('short_description');
instance.incident_state = incidentGR.getValue('state');
} else {
gs.info("No incident found with sys_id: " + triggerId);
}
And In HTML:-
<div>
<!-- Display additional incident details -->
<small>Incident Number: {{::instance.incident_number}}</small><br/>
<small>Short Description: {{::instance.incident_short_description}}</small><br/>
<small>State: {{::instance.incident_state}}</small><br/>
</div>
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:16 AM
Hi @SandeepKSingh
Open The Widget "My Survey"
And you need to clone the widget before do any changes.
Then Just add the below code in Server side script and HTML :-
Server Side :-
var triggerId = instance.trigger_id;
gs.info("Trigger ID: " + triggerId);
var incidentGR = new GlideRecord('incident');
if (triggerId && incidentGR.get(triggerId)) {
gs.info("Incident found with sys_id: " + triggerId);
instance.incident_number = incidentGR.getValue('number');
instance.incident_short_description = incidentGR.getValue('short_description');
instance.incident_state = incidentGR.getValue('state');
} else {
gs.info("No incident found with sys_id: " + triggerId);
}
And In HTML:-
<div>
<!-- Display additional incident details -->
<small>Incident Number: {{::instance.incident_number}}</small><br/>
<small>Short Description: {{::instance.incident_short_description}}</small><br/>
<small>State: {{::instance.incident_state}}</small><br/>
</div>
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 05:14 AM
That's Exactly it worked thanks 🙂