Use Flow to Prevent Field Updates

Marc D
Tera Contributor

Hello everyone. I have a requirement that I'm not sure how to approach.

 

A client wants to have Case Tasks created when a Case's State field updates to a specified value (for the sake of example, let's say Open). At the same time, the client wants to make sure that the Case can NOT have its State field changed until the generated Task is closed (so in the example, State would stay at Open and would not be allowed to change until the Task was closed).

 

I was thinking about using Flow Designer for this, but I could not find any action or subflow to prevent a user from updating the triggering Case's state field until the auto-created Task was closed.

 

I had thought of a workaround involving UI policies, but they would only work if the Flow were to automatically change the State field after the Task was completed, and the client has made it clear they do not want the State to be changed automatically at any point - they want manual changes only.

 

Could somebody please help with determining a way to prevent a field from updating until the related task is finished? Thank you in advance.

1 ACCEPTED SOLUTION

Sainath N
Mega Sage
Mega Sage

@Marc D : I could think of the below two approaches to handling this situation.

 

1. Configure Onload client + Script Include to lock the field until the task gets closed associated with this case.

 

OnLoad: Use Glide Ajax to call the script and include and lock the field based on the response (If it's still open) using g_form.setReadOnly('field_name', true);

 

  Script Include: Function to check if the case task is closed or still open for this case and return the response to client.

 

With this approach, the state field will be read-only until the case gets closed, which prevents updates on this field.

 

2. Before update business rule on the case table with a condition, when the state changes: This should have the logic to check if this case still has an open-case task, and based on that, we can abort the action using current. setAbortAction(true)

 

With this approach, the field will be editable by the user but will not be committed to the database.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution. 

 

 

 

 

View solution in original post

2 REPLIES 2

Sainath N
Mega Sage
Mega Sage

@Marc D : I could think of the below two approaches to handling this situation.

 

1. Configure Onload client + Script Include to lock the field until the task gets closed associated with this case.

 

OnLoad: Use Glide Ajax to call the script and include and lock the field based on the response (If it's still open) using g_form.setReadOnly('field_name', true);

 

  Script Include: Function to check if the case task is closed or still open for this case and return the response to client.

 

With this approach, the state field will be read-only until the case gets closed, which prevents updates on this field.

 

2. Before update business rule on the case table with a condition, when the state changes: This should have the logic to check if this case still has an open-case task, and based on that, we can abort the action using current. setAbortAction(true)

 

With this approach, the field will be editable by the user but will not be committed to the database.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution. 

 

 

 

 

Marc D
Tera Contributor

Hello, thank you. The second option worked just fine.