alternate for getUniqueValue() in service portal?

shivambitanwar
Tera Expert

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?

2 ACCEPTED SOLUTIONS

Chuck Tomasi
Tera Patron

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?


View solution in original post

4 REPLIES 4

Chuck Tomasi
Tera Patron

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?


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.


This is giving -1. I want to get the sys_id with which this record will be save din database.