- 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-24-2025 08:13 PM
you can use this syntax to set value in string variable from widget client controller
$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-25-2025 05:56 AM
Is any further setup required to use that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 06:22 AM
that's it.
what's the issue you are facing?
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: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:33 AM
That might have been the issue. My client controller begins with the following:
api.controller = function() {
var c = this;