- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 01:57 PM
I have a custom widget which is pulling driving directions from a API and parsing it as a string to a variable.
I can see that the directions are parsed correctly via console or system logs, however I now want to pass them to a text multi-line variable I have on the Catalog Item. I browsed the forums and saw some mentions of using $scope but nothing has seemed to work and I'm not familiar with AngularJS.
What is the optimal and/or easiest way to pass this string from the widget to the catalog item variable?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 06:23 AM
something like this
api.controller = function($scope) {
/* widget controller */
var c = this;
$scope.page.g_form.setValue('variableName', 1);
};
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-25-2025 06:36 AM
then use the syntax I shared and it should work fine
api.controller = function($scope) {
/* widget controller */
var c = this;
$scope.page.g_form.setValue('variableName', 'Your Value');
};
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-26-2025 03:28 AM
Hope you are doing good.
Did my reply answer your question?
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-26-2025 08:45 AM
Thank you @Ankur Bawiskar! $scope not included in the function param was the issue.