- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 05:22 AM
I want to create a business rule that create and takes the value from different table. For ex:
table1 fields- name , date, priority(1,2,3), type.
table2 fields-name,date,type
whenever i select priority as 1 in table1 ,it should create a new record in table2.
I tried it with Gliderecord.initialize but not sure how that works.
Note: Both table are part of same application but the values are not inherited/refreneced from each other.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 07:46 PM
it does not matter if there is any relationship build or not. record should be create. i tried at my end and it's working..
Result:
Note: Please validate your script and check if something is conflicting .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 05:43 AM
create after business rule on table1 and mention the trigger condition current.priority=='<select your value>'
var gr = new GlideRecord('table2');
gr.initialize();
gr.name = current.name;
gr.field= current.field;
gr.date= current.date;
gr.type= current.type;
gr.insert();
let me know if you have any further question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 05:44 AM
please validate field name , i just randomly mentioned the name..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 06:22 PM
Hey Harsh,
I tried this code and this worked in a case where tables are interlinked with each other or childs of same parent.But in my scenario tables are not linked with each other in any case however the field names,types are same.Both tables are part of same app. but are not linked with each other.
Here is the code that i tried:
var nr = new GlideRecord('u_maintenance_window');// now it doesnot create any record for me in u_maint_window table
nr.initialize();
nr.event_name = current.u_name;
nr.insert();
however if i try the same code on a differentapp where both tables are a referenced from a parent it works fine.Did I miss something in here?
Regards,
Akshay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 06:40 PM
is the table name u_maintenance_window or u_maint_window ? Also, can you please check if there is any data-policy which is causing an issue.
It should work, i don't think both the tables are needs to be related to each other, since here you are not trying to set any field with parent-child relationship.