- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 08:41 AM
I have tried both before and after business rules. Even if I have "insert" checked, they only ever work on update. I have two reference fields on the same form. I want to populate u_tac_business_app with the value of u_business_application (dot walked from the other reference field: u_tac_record). This is the current after BR I have. Please help.
(function executeRule(current, previous /*null when async*/) {
current.u_tac_business_app = current.u_tac_record.u_business_application;
current.update();
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 09:52 AM
Hello
Agreed with What dirk Said, Never ever use current.update() in before business rule.
Check field name correctly:
(function executeRule(current, previous /*null when async*/) {
gs.log("Check Value :"+current.u_tac_record.u_business_application); /
current.u_tac_business_app = current.u_tac_record.u_business_application;
gs.log("Updated value"+current.u_tac_business_app);
})(current, previous);
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 09:33 AM
If the dot walking does not work on the INSERT, I suggest to try with querying the referenced table manually using a GlideRecord on that table to query the data.
Can you check, if that works?
Let me know.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 09:38 AM
I am novice at best, could you give me an example script to off of? Please. 🐵

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 10:24 AM
Hi
Now I just gave it a try to replay your scenario.
I created two separate tables:
And the second table:
Then, I created a Business Rule (on Table A), to complete, what you are asking for:
This Business Rule fires on INSERT and UPDATE:
I tested it on INSERT and UPDATE, and it worked.
Maybe you try to replay my example to review, if that works for you as well, and then transfer that into your specific scenario.
Let me know, if that works, and mark my answer as correct and helpfulm,please.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2019 12:58 PM
Hi Dirk!
Sorry for the delay; took a mini vacation over the weekend. The scenario you presented is almost like mine.
Table A (u_technology_access_requests) => Field A (u_business_application; the value I need to copy over)
Table B (u_access_tasks) => Field B (u_tac_record; references record in Table A; the parent) & Field C (u_tac_business_app; a reference field that I need to populate with Table A, Field A)
Both Field A and Field C point to the same reference table (cmdb_ci_business_app).
This is the code I tried using based on your feedback. Now it isn't working for insert or update.
Runs on table: u_access_tasks, Before, order 100, runs on insert and update
(function executeRule(current, previous /*null when async*/) {
current.sysID = current.u_tac_record.u_business_application;
current.setValue = (u_tac_business_app, sysID);
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 10:26 AM
HI
Of coure, you need to first create a few records in table B, and then try to capture the records in Table A, by just filling in the reference to one record in table B.
That way, the user captured in table B will be copied over to the new record in Table A.
Let me know, if thats fine for you.
BR
Dirk