If the field was updated by a business rule, the scheduled job cannot override it?

Neha Maurya
Tera Contributor

Please help how I can ensure if the field was updated by a business rule, the scheduled job cannot override it?

 

I have found this somewhere-
Use a Before Update Business Rule
 create a Before Update business rule to prevent overwriting:
• Table: Select the target table
• When to Run: Before Update
• Condition: current.your_field.changes() && previous.your_field != ''
This ensures that if the field was updated by a business rule, the scheduled job cannot override it.

 

Please confirm, if anybody has already used it before? or is there any other or better way to achieve it.

 

2 ACCEPTED SOLUTIONS

Hello @Neha Maurya 

 

Yes it will work. It will stop all updates in the system, once value is fixed, it will be fixed. If you want to change it agian, you will have to deactivate the BR, as also mentioned by me in first response, then we somehow got to other solutions and now back to this. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

View solution in original post

Shivalika
Mega Sage

Hello @Neha Maurya 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE

 

View solution in original post

10 REPLIES 10

Ok @Neha Maurya 

 

Then that's quite simple, create q service account with sufficient access and "RUN AS" the scheduled job with this user only. 

 

Then in you BR, you can add conditions that Updated by is "THIS SERVICE USER" and abort action , before Update BR. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Neha Maurya
Tera Contributor

Hi Shivalika,

 

We cannot do anything with the scheduled job. We are not allowed to. Can you please suggest a way from the business rule only, to stop the Scheduled job overwrite the records.

See @Neha Maurya there is only one way to identify who updated the field - that is updated by field on the table. Now if that is "System" for all the updates - how will you identify which one exactly is done by "system" and "job"? 

 

There's practically no way. The method I suggested not only is feasible but also comes under the best practise - that if you are updating any field - the updated by should be some other user with enough rights - so that in future you can easily identified how were updates made. 

 

That will make your task way easier. So try figuring out with your team , if you can change the "Run AS" field of the job to some other sufficient access account. 

 

I hope you understand the logic and feasibility here and I helped you answer your queries. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Neha Maurya
Tera Contributor

Hi Shivalika,

 

Got your point. However, will the below approach mentioned by me will work to stop overwriting?

 create a Before Update business rule to prevent overwriting:
• Table: Select the target table
• When to Run: Before Update
• Condition: current.your_field.changes() && previous.your_field != ''

 

can you also please help me understand the condition, how it is working and the logic of it

 

 

Hello @Neha Maurya 

 

Yes it will work. It will stop all updates in the system, once value is fixed, it will be fixed. If you want to change it agian, you will have to deactivate the BR, as also mentioned by me in first response, then we somehow got to other solutions and now back to this. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY