Sorry, this is about the user themselves. Rather than another user and locking records.
If you have particular fields that you want to hide or show, depending on the record mode that you're in, then this is one way to do that. It's all client view (javascript) code rather than server side.
Hiding/Showing field depending on whether editing or viewing.
Collapse
X
-
Do note that I think as of v7.2 or possible 7.0, EspoCRM will popup 'error conflict need to resolve', if someone made an edit and then you save the records without realizing someone were faster than you.
I'm guessing you doing this in one way is to prevent 'double data-entry'?Leave a comment:
-
Hiding/Showing field depending on whether editing or viewing.
You can use a dynamic handler to hide or show a field (along with a bunch of other stuff).
If you want to specifically hide/show a field based on whether someone is currently editing a record or not, you can create a dynamic handler function like the following. (you'll need to assign the dynamicHandler property to this script in the clientDefs json file too, or amend your existing dynamicHandler code)
HTML Code:define('custom:views/my-entity-handler', ['dynamic-handler'], function (Dep) { return Dep.extend({ init: function () { // Bind the mode change event and then call function as we want to set it up initially too, not just wait for the event. this.recordView.on('after:mode-change', this.viewModeChange.bind(this)); this.viewModeChange(this); }, viewModeChange: function() { // A bit of console logging console.log(`RecordView mode is ${this.recordView.mode}`); if (this.recordView.mode==='edit') { this.recordView.showField('fieldNameHere'); } else { this.recordView.hideField('fieldNameHere'); } } }); });
Tags: None
Leave a comment: