
At times you might want to remove certain capabilities from a detail in bpm’online. Sure, you could change permissions on the object the detail is based on, but it’s also possible to do this in code in the detail schema as well. One benefit to doing this in code is it allows you to conditionally remove or add these capabilities.
It’s a fairly easy task, all you really need to do is override some functions in your detail itself. To remove add, edit, copy, and delete capabilities from you detail, open the detail schema and add the following to the methods. Note, this code goes in the detail schema, not the page. When you run the detail wizard, it will create a client schema named something like “Detail schema: “My detail object name”. This code goes into the methods of that file.
// remove the add (+) button getAddRecordButtonVisible: function() { return false; }, // remove the edit option getEditRecordMenuItem: Terrasoft.emptyFn, // remove the copy option getCopyRecordMenuItem: Terrasoft.emptyFn, // remove the delete option getDeleteRecordMenuItem: Terrasoft.emptyFn
Obviously, you can pick and choose which of those you want to remove (for example, to only remove delete, only add that line). We’re basically overriding these functions in the BaseGridDetailV2, which your detail inherits from, and either returning false (in the case of the add button) or just stubbing out the functions with and empty function (instead of returning the menu item config).
If you’d also like to prevent opening the edit page for the detail when a row is double-clicked, you can add:
openCard: Terrasoft.emptyFn
If I have the same detail used in 2 different sections and I want to remove the edit or delete in one of the sections is there a way to throw a condition in to choose what page we want the remove to happen ?
Hello Serge,
Yes, this article shows how to do that: https://customerfx.com/article/conditionally-making-a-detail-read-only-in-creatio/
Ryan