- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:16 PM
Hi All,
I have 2 tables user table & personal data table. Personal email id available in personal data table available. Now i need to update personal email id in user table. In both tables employee id available based employee id i need to update personal email in user table. How we can achieve this..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:43 PM - edited 07-07-2023 11:00 PM
Hi @Dasari Srihari,
You need to create after insert/update business rule on personal data table. Below shared the sample scripts, modify it accordingly.
Sample scripts:
var user_record = new GlideRecord('sys_user');
user_record.addQuery('employee_id', current.employee_id_column_name); // current: object for personal data table
user_record.query();
if (user_record.next()) {
user_record.personal_email_id = current.personal_email_id_column_name.toString();
user_record.setWorkflow(false); // disables the other business rules
user_record.autoSysFields(false); // used to disable the update of 'sys' fields (Updated, Created, etc.) for a particular update
user_record.update();
}
Please mark as helpful and correct, if I have been able to assist you in any way!
This will be useful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:28 PM
Hi @Dasari Srihari,
What you start so far and where you stuck? Do you need background scripts or you need business rule to update personal email id on insertion/ updation of record in personal data table?
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:29 PM - edited 07-07-2023 10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 10:43 PM - edited 07-07-2023 11:00 PM
Hi @Dasari Srihari,
You need to create after insert/update business rule on personal data table. Below shared the sample scripts, modify it accordingly.
Sample scripts:
var user_record = new GlideRecord('sys_user');
user_record.addQuery('employee_id', current.employee_id_column_name); // current: object for personal data table
user_record.query();
if (user_record.next()) {
user_record.personal_email_id = current.personal_email_id_column_name.toString();
user_record.setWorkflow(false); // disables the other business rules
user_record.autoSysFields(false); // used to disable the update of 'sys' fields (Updated, Created, etc.) for a particular update
user_record.update();
}
Please mark as helpful and correct, if I have been able to assist you in any way!
This will be useful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2023 12:57 AM - edited 07-08-2023 01:07 AM
Hi @Sagar Pagar , Thanks for your response. it is working.
Same script i need to run for fix script as well for existing record