- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 09:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 02:08 AM
You need to add some query if you want to update existing record.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('u_table_1');
gr.addQuery(); // eg. gr.addQuery('fieldName', 'value');
//gr.addQuery('active', true); // eg
gr.query();
//gr.insert(); // use this line if you want to create new record
while(gr.next()){
gs.log(gr.u_table_2); // here use gr.fieldName
gr.fieldName = 'value';
gr.update(); // to update the record matching your query.
}
})(current, previous);
Note: replace fieldName as per your column/field names in your tables.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 03:38 AM
For 1 point You can use below script:
you can create a Before Insert BR on that table where you are inserting a record like table1.
var gruser = new GlideRecord('table2');
gruser.initialize();
gruser.first_name=current.u_first_name;
gruser.last_name=current.u_last_name;
gruser.email = current.u_email;
gruser.user_name = current.u_name;
gruser.insert();
You can rename the variables as per your requirement.
For point 2 both tables must have some linkage then only we can update a record.
Thanks,
Lovely.