- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 12:13 AM
I have a requirement to create a record producer to update the user table. When the record producer is opened, the person who is logged in, all his data from the user table are automatically populated in their related variables of the record producer, then the user can update the values and on submit , the existing record in the user tables gets updated without creating a new record. Can someone help me on this? On how to start?
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 12:24 AM
Hi Kevin,
Please follow the below steps, your requirement will be fulfilled:
1. First, create a record producer and create all the necessary variables in the record producer.
2. Create an onload script, to update all the logged-in user details in the Record Producer.
3. Write Record Producer script, such that first if should query the User table to check the record exists for the Logged-in user or not. If exist simply update the fields what he has updated in Record producer, If the record doesn't exist then simply create a record in User Table.
Please Feel free, to ping me if you stuck somewhere.
Please mark it as Correct/Helpful if it fulfills your requirement
Thanks
Vamshidhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 07:36 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 02:01 AM
Did you get a chance to check on comment from my side.
I would recommend using catalog item for this requirement.
Users might feel improper if you allow update and then stop form submission with the message
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 01:13 AM
record producer is not the right approach here
User can fill the values and script can update it and stop the new record creation.
I would suggest to use Catalog Item
Once RITM is generated you can have workflow run script to update the fields
Workflow won't have any approvals etc
Just 1 run script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 05:20 AM
I will try doing it as a catalog item also. Thank you for the suggestion

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2020 05:00 AM
Hello
Ankur's suggestion is right, you need to create a catalog item.
Adding in Ankur's reply code for workflow is,
var gruser=new GLideRecord('sys_user');
gruser.addQuery('username',current.variables.userid);//considering username field on user table and userid is a variable name on form.
gruser.query();
if(gruser.next())
{
gruser.setValue('user table field 1',current.variables.variable 1);
gruser.setValue('user table field 2',current.variables.variable 2);
gruser.setValue('user table field 3',current.variables.variable 3);
gruser.update();
}
Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.
Regards
Yash.K.Agrawal