Service Portal -using Widgets server script insert incident using HTML button and auto populate fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 03:08 AM
Hi All,
In service portal, when end user clicks on button/ link i need to create incident automatically and auto populate some fields using server side script.
for this case i already written below function in widget's server script field and called from HTML
***server script in widget***
function createIncident(){
var newincident=new GlideRecord("incident");
newincident.initialize();
newincident.assignment_group.setDisplayValue("ABC");
newincident.caller_id=gs.getUserName();
newincident.short_description="Test";
newincident.impact=1;
newincident.category='Other';
newincident.subcategory='pqr';
newincident.insert();
}
******** HTML body in Widget****
<a href="https://www.google.com" ng-click="createIncident()" target="_blank"> <p style="font-size:27px;"> Testing </p></a>
in above html code i have called createincident function using ng-click deirective.
But its not working incident is not created in incident table. Could please help me here how to call above server script in html so that on click of link in HTML it will create incident in the back end .
Thank you in advance
Regards,
Akshay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 03:18 AM
Hi,
Please check below video, It will be helpful to learn and use logic to achieve your goal.
https://www.youtube.com/watch?v=ChTgHPTqNFU
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 03:21 AM
Hi,
Also check below link for similar solution:
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 05:56 AM
Thank you Anil!