- 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 07:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 11:56 AM
Hello Akshay,
I hope response from Harsh has helped you.
initialize, newRecord are functions which sets the boilerplate to get a record created. (initialize sets an empty field boilerPlate and newRecord considers default and assign sys_id, doesn't wait for insert to assign sys_id unlike initialize).
try this out :
var gr = new GlideRecord('att_tdi');//lol you may use any table to understand the behaviour
gs.addInfoMessage(gr.sys_id);
gs.addInfoMessage(gr.isNewRecord());
gr.insert();
gs.addInfoMessage(gr.sys_id);
gr.initialize();
gs.addInfoMessage(gr.sys_id);
gs.addInfoMessage(gr.isNewRecord());
gr.insert();
gs.addInfoMessage(gr.sys_id);
gr.newRecord();
gs.addInfoMessage(gr.sys_id);
gs.addInfoMessage(gr.isNewRecord());
gr.insert();
gs.addInfoMessage(gr.sys_id);
So do you want to get a copy of P1 in some another table(Hope you want to keep the P1 in sync with table1); I would ask you opt for async if and use of a script include keeping these records in sync.
BR
Surendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 09:35 PM
Hi Surendra,
I got what is explained by everyone maybe for my app it is not working because i might have messed with ACL's . Just wanted check if script include is really required to have these records in sync??. they are working fine for me when I applied async BR on a different application.
Regards,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2017 10:30 PM
No push to use Script Include and even async; if its working fine
my bit was to help you understand initialize and NewRecord.
Just think about code reuse and modularity (nothing to do anything specific with ServiceNow).
Cheers.