widget on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 09:35 PM
I have created widget on service portal
in the body html template I have added few fields like caller, category, contact type, description and short description along with submit button
if i click the submit button new tab should be open incident form with pre filled above details, need to save incident form manually
in the client controller I have added beow script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 09:41 PM
share the html code as well and also the complete client controller
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 09:42 PM
try this
$scope.submitForm = function () {
var callData = {
caller_id: $scope.data.caller,
category: $scope.data.category,
contact_type: $scope.data.contact_type,
short_description: $scope.data.short_description,
description: $scope.data.description
};
// Construct the URL with query parameters
var url = '/incident.do?sys_id=-1' +
'&sysparm_query=caller_id=' + encodeURIComponent(callData.caller_id) +
'^category=' + encodeURIComponent(callData.category) +
'^contact_type=' + encodeURIComponent(callData.contact_type) +
'^short_description=' + encodeURIComponent(callData.short_description) +
'^description=' + encodeURIComponent(callData.description);
// Open the URL in a new tab
window.open(url, '_blank');
};
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 10:37 PM
Hi @Ankur Bawiskar
all values are populating except caller_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 10:43 PM
caller_id field is reference to sys_user so it requires sysId of user.
is the input type in HTML giving you sysId or string?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader