How to prevent users from creating a new change task record?

thrsdy1512
Tera Expert

 

 

I need to prevent users from being able to create new change tasks where type = type A, these tasks can only be created automatically when a Change Request is progressed to the Assess state.

I have a before insert business rule that is running on the change_task table where the task type = type A to prevent submission & display error message, which works.

 

The issue I have is when a Change Request move to the Assess state, the change request is displaying the error message. the change task is being created automatically &  and it shows in the change_task table as being created by the same user ID as the person creating the change req. I want this error msg to only be displayed on the change task itself where a user is creating it directly from the change_task table.

 

How can I prevent this error message from being displayed on the change request form when the change req state triggers the creation of the task type = type a.

 

Business rule is:

 

(function executeRule(current, previous /*null when async*/) {

    if (current.change_task_type == 'peer_review') {
     

         
            gs.addErrorMessage('This task cannot be created by users. This  can only be created by the system when progressing a Change request.');

            // Prevent the record from being saved
            current.setAbortAction(true);
        }
    }
)(current, previous);
1 ACCEPTED SOLUTION

I was able to reach a solution by setting the following filter conditions on my business rule, have tested it across different scenarios and seems to be doing what I needed, thank you for you suggestion of using filters, wouldn't have thought of doing it this way otherwise:

thrsdy1512_0-1738159207004.png

 

View solution in original post

10 REPLIES 10

I tried this and its working for me. However i want to hide this 'New' button in Service Operations Workspace as well. How can i achieve this ?