- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 12:18 AM
Dear all,
I have an UI action which open a Record producer which will be in charge of creating a task assigned to the user which has open the record producer.
In my User table record I add a UI action button.
In my record producer it is mapping to table task
When my Record Producer loads, I need to set the task.assignTo value of my producer to be the user which has open the UI action
For exemple, if my current user record name is : John
Then user press on UI action which shows the record producer
Record producer field assignto should be = to john
How can I achive this ?
I guess I should do it from a catalog client script onLoad ?
What script should I write in to achive my goal ?
Thanks for help
regards
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 03:15 AM
Hi Wakespirit,
I assume this issue is resolved as per the other thread.
Kindly mark the answer as correct so that others get benefitted from it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 12:28 AM
Hi wakespirit,
I think you can below script as default value. Logged in User will be the one who can click the UI Action.
javascript:gs.getUserID();
On Load client script might impact when the Record Producer is opened through portal directly.
- Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 12:41 AM
Thnaks for your reply.
I miss you miss understand.
I do not want to get the current login user, but instead the user record sys_id value which was open and call the record producer.
The process is has below :
- I go to users in Servicenow
- open a user record
- Click on New task button ( Ui Action)
Record producer default value Assigned to = user.sys_id
How to achive that field initialisation of my record producer ?
Thnaks for help
regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 01:04 AM
Hi Wakesprit,
In the UI action, you can get the user id of the record from which the UI action is clicked by using
g_form.getUniqueValue()
Then you can pass this as a parameter to your Record producer and can set it.
Kindly mark my answer as correct if this works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 01:22 AM
Here is below my UI action :
var gform=new GlideDialogWindow('test_producer');
var user=g_form.getUniqueValue();
gform.setPreference('name_text',user);
gform.setTitle('Test record producer');
gform.render();
I added what you suggest .
Then I pass the variable to the dialog window as name_text variable
How can I set my Recorder producer field with it then ?
screen shot would help
thnaks