- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2018 03:13 PM
I feel a bit lost when trying to solve a specific problem on a UI Page where there might be a "sysparm_recordid" parameter in the URL.
I've tried all sorts of variations, but no luck getting the value of my URL parameter into my scope.
var myApp = angular.module('voicemailSupport', []);
myApp.controller('voicemailData', function($scope, $location, $window, $timeout, $interval, $document) {
$scope.recordID = $location.search().sysparm_recordid;
});
I don't need to do any updating of the URL - just want to grab the value of the parameter of the page that was loaded.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2018 06:27 AM
I think I have it figured it out after reading through your reply and some more examples out there:
var myApp = angular.module('voicemailSupport', [], function($locationProvider) {
$locationProvider.html5Mode(true);
});
myApp.controller('voicemailData', function($scope, $location) {
$scope.recordID = $location.search().sysparm_recordid;
});
This seems to work in all browsers I test, plus I don't have to utilize Jelly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2018 04:05 PM
hi there,
you mentioned ui page and i presume u wanted to get the url params within "Processing Script" section?
have you try
GlideSession
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=c_GlideSessionScopedAPI
E.g.
var session = gs.getSession();
session.putClientData('test1', 'Harry');
var clientData = session.getClientData('test1');
gs.info(clientData);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2018 07:19 PM
I actually want to be able to use the URL parameters within the AngularJS code of the client script section, so I won't be using the UI Processing section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2018 09:31 PM
hi there,
have u try following object in client script? It contain the entire URL (including params).
window.parent.location.href
I just did a try with existing $pwd_change ui page by inserting the following at the 1st line in client script:
alert('Here = '+window.parent.location.href);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2018 05:31 AM
Getting the URL is not a problem (with $window.location in AngularJS) - I just can't seem to find a consistent way to parse out a specific parameter from the URL.
