- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 08:08 AM
HI Team,
I am using Before Insert BR to auto-populate/save the 3 fields on the child task which I am getting it by gliding the parent i.e customer_project as below:
Other than manually creating the task, there is also a way task is getting created from FlowDesigner , in such case how can we update the record, as current.update cannot be used in BR as best practise.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr=new GlideRecord('customer_project');
gr.addQuery('number',current.top_task.number);
gr.query();
if(gr.next()){
gs.info('Hello :'+ gr.u_order);
current.u_service_delivery_contact=gr.u_service_delivery_contact;
current.u_location_child_account=gr.account;
current.u_customer_order=gr.u_order;
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 08:14 AM
Hello,
In a before business rule the "current" object doesn't need current.update() as it's already going to be updated naturally without it when setting values to current.field_name, etc.
Have you tried?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 08:14 AM
Hello,
In a before business rule the "current" object doesn't need current.update() as it's already going to be updated naturally without it when setting values to current.field_name, etc.
Have you tried?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 08:19 AM
Is the child task being created when the parent is created? In that case you wouldn't be able to update the fields because it had yet to be created in a "before insert" situation.
Make sure this business rule is referring to the child incident/task. That way the parent is created and before the child is created, the rule kicks off.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 08:20 AM
You don't need to GlideRecord the Customer project table, you can directly dot walk and get the value:
current.u_service_delivery_contact=current.top_task.u_service_delivery_contact;
current.u_location_child_account=current.top_task.account;
current.u_customer_order=current.top_task.u_order;
Alternatively, it can also be to directly set as default value at dictionary level, you can go to dictionary and set default value as following:
For u_customer_order field:
javascript: current.top_task.u_order;
Similarly, you can do for other fields.
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar