Question

Lock a single field conditionally using client module

Hello,

 

I have read through on locking fields using client module in Creatio. I have found that we can simply setting the "isModelItemEnabled" to true/false. And for more complex situation, we can create a function named "isModelItemEnabled" and write our code logic and return boolean value conditionally.

 

At the same time, I noticed that "isModelItemEnabled" is triggered before "onEntityInitialized" is triggered. This results to some of the values required to be used in "isModelItemEnabled" undefined.

 

Is there anyway to workaround this?

Like 0

Like

2 comments
Best reply

Rather than create a function, use an attribute. Then in the onEntityInitialized you can read any values and then set the attribute to true/false. See an example here: https://customerfx.com/article/completely-locking-a-page-via-code-inclu…

Also, just to point out, you mention locking a single field. If all you need is to lock a single field, there's no need to use IsModelItemsEnabled. Instead you can bind the visible for the field to an attribute and set as true/false as needed. See https://customerfx.com/article/how-to-enable-or-disable-a-field-on-a-pa…

Ryan

Rather than create a function, use an attribute. Then in the onEntityInitialized you can read any values and then set the attribute to true/false. See an example here: https://customerfx.com/article/completely-locking-a-page-via-code-inclu…

Also, just to point out, you mention locking a single field. If all you need is to lock a single field, there's no need to use IsModelItemsEnabled. Instead you can bind the visible for the field to an attribute and set as true/false as needed. See https://customerfx.com/article/how-to-enable-or-disable-a-field-on-a-pa…

Ryan

Okay, I will try it out. Thank you very much Ryan, best as always😄

Show all comments