how to clear field value

ammar_k
Tera Contributor

Hello,

I have an issue where the closed_by and closed_at fields are being populated when they shouldn't be.

Until I determine the root cause, I would like to automatically clear these field values after a record is updated. Would a Business Rule or UI Policy be the best approach for this?

What would be the most effective way to implement this?

Thank you!

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @ammar_k,

 

Obviously the best solution is to find the script or trigger causing this update, however to answer your question directly (noting you've already called this out and this is a temporary band-aid), an after Business Rule would be the way to go. Please note, set the 'order' value of the business rule to 900 for example.

The reason to leverage an after business rule with the order value is to ensure this is (hopefully) the last server side call and update to clear the values.

 

Obviously, I am going to try and steer you back to trying to solve the root cause before implementing the above, so run the 'Script Tracer' which will show all Scripts, Business Rules etc which should indicate what is actually updating this ; )

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

View solution in original post

4 REPLIES 4

Robbie
Kilo Patron
Kilo Patron

Hi @ammar_k,

 

Obviously the best solution is to find the script or trigger causing this update, however to answer your question directly (noting you've already called this out and this is a temporary band-aid), an after Business Rule would be the way to go. Please note, set the 'order' value of the business rule to 900 for example.

The reason to leverage an after business rule with the order value is to ensure this is (hopefully) the last server side call and update to clear the values.

 

Obviously, I am going to try and steer you back to trying to solve the root cause before implementing the above, so run the 'Script Tracer' which will show all Scripts, Business Rules etc which should indicate what is actually updating this ; )

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

ammar_k
Tera Contributor

Hello, with script tracer i was able to identify the root cause and solve the problem.

thank you

Hi @ammar_k,

 

Awesome. I'm glad we managed to solve the underlying issue. The Script Tracer is often overlooked but is a great tool at the Developers disposal ; )

 

Thanks for marking my response as the solution. Happy Thursday. Have a great day.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

Nilesh Pol
Tera Guru

Hi @ammar_k 

use After BR, with following script:

if (current.closed_by || current.closed_at)

{

current.closed_by = null;

current.closed_at = null;

current.setWorkflow(false);

current.update();

current.setWorkflow(true);

 }