Question

Locking all fields on a page is not working.

Hi All,

 

I am trying to lock all the fields on a page. So I have followed the following article:

"https://academy.creatio.com/docs/developer/interface_elements/interface_control_tools/locking_edit_page_fields/overview"

I have set the value of IsModelItemsEnabled to false in methods of the edit page in following ways,

  1. setCardLockoutStatus: function() {

                    this.set("IsModelItemsEnabled", false);

                },
  2. onEntityInitialized: function(){

                    this.callParent(arguments);

                    this.set("IsModelItemsEnabled", false);

                },

But still all the fields are editable. Can anyone suggest what am I doing wrong?

Like 0

Like

2 comments
Best reply

Hi,

 

Tested on the AccountPageV2 schema and it worked properly:

 

1) Enable the feature via the database:

DECLARE @allEmpoyeeGroupName nvarchar(max) = 'All employees';
DECLARE @featureName nvarchar(max) = 'CompleteCardLockout'
DECLARE @featureStatus bit = 1;
 
IF (NOT EXISTS (SELECT NULL FROM Feature WHERE Code = @featureName))
BEGIN
  INSERT INTO Feature (Name, Description, Code, ProcessListeners) 
  VALUES (@featureName, @featureName, @featureName, 0)
END
IF(EXISTS (SELECT NULL FROM AdminUnitFeatureState 
         WHERE FeatureId = (SELECT Id FROM Feature WHERE Code = @featureName) AND
           SysAdminUnitId = (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName)) )
BEGIN
  UPDATE AdminUnitFeatureState SET FeatureState = @featureStatus WHERE FeatureId = (SELECT Id FROM Feature WHERE Code = @featureName) AND
                              SysAdminUnitId = (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName)
END
ELSE
BEGIN
  INSERT INTO AdminUnitFeatureState (ProcessListeners, SysAdminUnitId, FeatureState, FeatureId) VALUES 
                    (
                    0,
                    (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName),
                    @featureStatus, 
                    (SELECT Id FROM Feature WHERE Code = @featureName)
                     )
END

2) In the AccountPageV2 added the following code to the diff array:

{
				"operation": "merge",
				"name": "CardContentWrapper",
				"values": {
					"generator": "DisableControlsGenerator.generatePartial"
				}
			},

3) In the AccountPageV2 added the following attribute:

"IsModelItemsEnabled": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: false
			},

4) Relogin to the app

5) Open account edit page

6) All the fields are locked

 

Best regards,

Oscar

Hi,

 

Tested on the AccountPageV2 schema and it worked properly:

 

1) Enable the feature via the database:

DECLARE @allEmpoyeeGroupName nvarchar(max) = 'All employees';
DECLARE @featureName nvarchar(max) = 'CompleteCardLockout'
DECLARE @featureStatus bit = 1;
 
IF (NOT EXISTS (SELECT NULL FROM Feature WHERE Code = @featureName))
BEGIN
  INSERT INTO Feature (Name, Description, Code, ProcessListeners) 
  VALUES (@featureName, @featureName, @featureName, 0)
END
IF(EXISTS (SELECT NULL FROM AdminUnitFeatureState 
         WHERE FeatureId = (SELECT Id FROM Feature WHERE Code = @featureName) AND
           SysAdminUnitId = (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName)) )
BEGIN
  UPDATE AdminUnitFeatureState SET FeatureState = @featureStatus WHERE FeatureId = (SELECT Id FROM Feature WHERE Code = @featureName) AND
                              SysAdminUnitId = (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName)
END
ELSE
BEGIN
  INSERT INTO AdminUnitFeatureState (ProcessListeners, SysAdminUnitId, FeatureState, FeatureId) VALUES 
                    (
                    0,
                    (SELECT Id FROM SysAdminUnit WHERE Name = @allEmpoyeeGroupName),
                    @featureStatus, 
                    (SELECT Id FROM Feature WHERE Code = @featureName)
                     )
END

2) In the AccountPageV2 added the following code to the diff array:

{
				"operation": "merge",
				"name": "CardContentWrapper",
				"values": {
					"generator": "DisableControlsGenerator.generatePartial"
				}
			},

3) In the AccountPageV2 added the following attribute:

"IsModelItemsEnabled": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: false
			},

4) Relogin to the app

5) Open account edit page

6) All the fields are locked

 

Best regards,

Oscar

Oscar Dylan,

 

I have tried this and able achieve my objective. Apparently what I was missing was, I have not added the code in diff array. Thank you so much for your time & effort.

 

Regards,

Sourav Kumar Samal

Show all comments