- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 04:10 AM
Is there an alternate for getUniqueValue() in service portal? I need to fetch sys_id of current record before it is saved to database. Is there a way to achieve this in service portal?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 06:10 AM
You can still use getUniqueValue() in the server script and pass it in the data object to the client, and hence present it in the HTML.
If that doesn't answer your question...
Can you provide more details? Perhaps share the code of your widget? Where are you looking to get this information, in the server script, client controller, or HTML?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 06:13 AM
g_form.getSysId() should work in SP.
documentation/client_scripting.md at master · service-portal/documentation · GitHub

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 06:10 AM
You can still use getUniqueValue() in the server script and pass it in the data object to the client, and hence present it in the HTML.
If that doesn't answer your question...
Can you provide more details? Perhaps share the code of your widget? Where are you looking to get this information, in the server script, client controller, or HTML?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 11:47 PM
Hi chuck, i am trying to build an application in Service Portal which is already build using ui pages and ui macros in service now . There is a ui action which is clientcallable. This ui action is using
var id = g_form.getUniqueValue(); alert(id);
in the code, which fetches the sys_id of the new record visible to the user. This record is not yet saved but id in the alert gives sys_id with which this record will be saved.
I have created this import ui action. on click of which there is a on-click function in which i was trying to use g_form.getUniqueValue(). which still gives me -1.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 06:13 AM
g_form.getSysId() should work in SP.
documentation/client_scripting.md at master · service-portal/documentation · GitHub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 11:48 PM
This is giving -1. I want to get the sys_id with which this record will be save din database.