restrict new button on workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-09-2024 08:33 AM
i am working on employee table in configuration workspace,
my requirement is if employee table record state is completed or canceled states,then employee_manager and employee_owner roles not able to create a new record in related lists those attached to employee table.
.most linky to restrict new button on related lists of employee table.
prefered was is ACL..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-10-2024 09:17 AM
Hi @VSN ,
Please use the below code snippet in the ACL(Create type) script(Ensure you enable the Advance on ACL to write the script)
(function executeRule(current, operation, previous /*null when 'create'*/) {
// Get the parent Employee record based on the relationship field
var employeeRecord = new GlideRecord('employee_table');
employeeRecord.get(current.parent); // Replace 'parent' with the actual field name that references the Employee table
// Check if the Employee record's state is either 'Completed' or 'Canceled'
if (employeeRecord.state == 'completed' || employeeRecord.state == 'canceled') {
// Check if the user has 'employee_manager' or 'employee_owner' roles
if (gs.hasRole('employee_manager') || gs.hasRole('employee_owner')) {
return false; // Denies create permission
}
}
return true; // Allows others to create records
})(current, operation, previous);
If my response has resolved your query, please consider giving it a thumbs up āā and marking it as the correct answerāā!
Thanks & Regards,
Sanjay Kumar