Optionally, TaskRay Project Templates can be locked down for editing using Salesforce Validation Rules.
By setting a restriction on editing templates, you can prevent users from modifying the template project and task details, including checklists and dependencies. In order to set such restrictions, you would need to create validation rules on three TaskRay objects: TaskRay Project, TaskRay Task, and TaskRay Checklist.
In the instructions below, the validation rules lock a project in a way that only a System Administrator can edit the templates. However, the same concept can be applied to any object and any user profile by adjusting the parameters of the validation rule.
With these validation rules in place, users with restricted template editing access will still be able to clone the templates to create new projects. The cloned projects will include all of the tasks and checklists, as well as be open for editing by all users.
Create a Validation Rule for TaskRay Project Object [Admin]
- From Setup, navigate to:
- Lightning: Objects and Fields | Object Manager.
- Classic: Create | Objects.
- Click on the TaskRay Project object in the list.
- In the Validation Rules section, click New.
- Enter the name for the validation rule.
- Check the Active checkbox.
- Optional: Enter description.
- In the Error Condition Formula section, enter the following formula: AND(TASKRAY__trTemplate__c = True, NOT(OR( $Profile.Name = "System Administrator")))
Note: In the formula above, the Profile Name "System Administrator" can be substituted for any other desired profile. The profile that is entered here will be the one that will have access to editing templates with the validation rule in place.
- Enter the Error Message that you want to display when the validation rule is triggered.
- Select where you want the error message to display (top of page or field).
Create a Validation Rule for TaskRay Task Object [Admin]
Repeat the steps above for the TaskRay Task object.
For step 7, change the formula to: AND(TASKRAY__Project__r.TASKRAY__trTemplate__c = True, NOT(OR( $Profile.Name = "System Administrator")))
Create a Validation Rule for TaskRay Checklist Object [Admin]
Repeat the steps above for the TaskRay Checklist object.
For step 7, change the formula to: AND(TASKRAY__TaskForGroup__r.TASKRAY__Project__r.TASKRAY__trTemplate__c = True, NOT(OR($Profile.Name = "System Administrator")))
Install Template Project Lock Package [Admin]
If you would like, you also have the option to install the validation rules outlined above directly to your Salesforce org from here.