- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2015 07:33 AM
Hi Goran,
yes if you put your code into into dynamic content blocks it will definitely work however u can not use embedded scripts in that. but problem of making REST calls still persists. so if you make REST calls using admin credentials in script. and now any user comes to portal n when they will come to your dynamic block and if they navigate somewhere else ,their session will automatically end and admin will be automatically logged in.
Let me post question in community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2015 12:03 AM
Hmm darn...
I took the "script" part in the ui page and på it in a UI script and called on it as well, and I guess thats the way I can do it.
Im wondering if I get the same "credentials"-problem if I use the code from the rest api explorer? When I look at the code it give me it doesn't look like the one we're using 😃
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2015 05:36 AM
Hi Goran,
I did post my question in community but no one replied.. and code u get from rest Api explorer requires u to pass username & password...problem with our app is that we do not know who is using the app..if we will make request with other user credential then it will log them out.
i can think of few solutions..
1)we can store user password in field type 'password(2way)'.. so in our app we can make a call to script include which will fetch username and password(we can decrypt password(2way) field) and set them in $http call. drawback:servicenow doesnt use password(2way) field by default to store password. it uses password(1way) and it is undecipherable. so somehow we neeed to store all passwords in custom field of password(2way) type.
2)we don't provide any credentials in $http call, let that popup come when they use app for the first time..after we make first REST call..Servicenow will return X-UserToken...we can use that token for sub sequent requests. drawback: user will have to manually enter username and passoword one time, even though they are already using the instance.
Geneva would be much better..in that we can make scripted REST services , and it can be public.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2015 07:34 AM
Hmm... Sadly I doubt any of those two solution would work for us
Wouldnt it be possible to instead of a rest call do a GlideAjax, have it get the objects, make a JSON encode and then in the ui script do a evalJSON to put in the $scope.numbers?
And the retreat suggestion is go back to jelly and do this inside a g2, and the publish it.. .but I don't wanna do jelly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2015 07:41 AM
Yeah that can also work. thats better than thinking about this authentication n stuff.
i hope you are aware about this ServiceNow Developers . it shows how to fetch data in JSON.