- 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 08:49 AM
Hi sarahyelton,
This below code will help you ,
(function executeRule(current, previous /*null when async*/) {
// gs.addInfoMessage(current.u_ritm);
var getReqby = new GlideRecord('sc_req_item');
getReqby.addQuery('sys_id', current.u_ritm);
getReqby.query();
if(getReqby.next()){
current.u_requested_by = getReqby.request.requested_for;
current.u_uses_netid_s =getReqby.variables.netid_passwords;
OR
var usr= new GlideRecord("sys_user");
usr.addQuery("sys_id",g_form.getValue("variable name goes here"));
usr.query(callBack);
function callBack(usr){
if(usr.next()){
g_form.setValue("variable name goes here",usr.employee_number);
}
}
If my reply helps you at all, Iād really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons.
Regards,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-14-2019 09:29 AM
Can you share a complete screenshot of business rule?
Thanks,
Abhishek
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-14-2019 09:45 AM
- 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-19-2019 01:08 PM
This worked! I am marking this as correct and marking Dirk's as helpful. If I could give him extra points for being extra helpful, I would. Thank you guys!