Hello,



For a new app on version 8.1, I'm trying to lock up all fields on a page based on the record condition. I have a Locked by field on the record and if the field is empty or different than the current user, I want to make the whole page read only. 



I was able to do that on previous versions by adding some code to the page. At high level I needed to add the  IsModelItemsEnabled attribute and have a "setCardLockoutStatus" method that triggers when the UsrLockedBy field changes. I also need to do a merge operation on the CardContentWrapper to set the generator value to DisableControlsGenerator.generatePartial.



What page code I need to write to accomplish something similar on 8.1? Or can that be accomplished now with no code?



Thanks,

Jose

Like 4

Like

4 comments
Best reply

Hello Jose,

 

The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages. 

However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:

 

The same approach might be implemented via code using the “readonly” attribute. Here is the example: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/customize-page-fields/examples/set-up-the-condition-that-locks-the-field#title-3819-2. You may create one common attribute that will be responsible for locking the fields, though in that case, you should manually add its name to the "readonly" value of every field.

 

Also, you may consider using record permissions instead of the "Locked by" field. This type of permission is based on the record authorship, here are the details: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/user-and-access-management/access-management/record-permissions.

 

Best regards,

Natalia

Hello Jose,

 

The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages. 

However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:

 

The same approach might be implemented via code using the “readonly” attribute. Here is the example: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/customize-page-fields/examples/set-up-the-condition-that-locks-the-field#title-3819-2. You may create one common attribute that will be responsible for locking the fields, though in that case, you should manually add its name to the "readonly" value of every field.

 

Also, you may consider using record permissions instead of the "Locked by" field. This type of permission is based on the record authorship, here are the details: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/user-and-access-management/access-management/record-permissions.

 

Best regards,

Natalia

Natalia Kalynovska,

Thanks Natalia. I do have a lot of fields on the page so I was looking for something like the CompleteCardLockout feature, but business rule will do. Do you know if there are any plans to have that feature on the freedom UI version? It takes some maintenance to keep those rules updated every time fields are added to the page.

Jose Hernandez,

 

We registered such a request for our R&D department, and they will consider implementing this feature for the Freedom UI pages.

Thank you for helping us to make our product better!

Natalia Kalynovska,

This feature would be very useful, definitely miss having that option that we had in Classic UI.

Show all comments

Hello!

 

Is there a way to block adding attachments and notes on any section. I want to do this on the Lead and Opportunity according to the Stage. If the Stage is Inactive. I won't be able to add any attachments and notes.

 

Thank you!

Like 0

Like

1 comments

 Hello,

 

Here is an example on how to achieve this in opportunity page:

 

1) Add the boolean column in the Opportunity edit page. The code for the column should be "UsrInactiveStatus". Save this change.

2) Create a business process that will set the value to true or false in case the status of the opportunity is either active or inactive (use "record modified" trigger signal which triggers on the opportunity modification in the "Stage" column (be careful not to cycle the business process, it's as a must to select the "Stage" column as a column that triggers the process)). Also at the end of the process execution it should refresh the current opporutnity page (use this marketplace app to achive this task).

3) Create a replacing view model for the "FileDetailV2" module and add the following code to the module:

define("FileDetailV2", [], function() {
	return {
		mixins: {},
		properties: {},
		attributes: {},
		messages: {},
		methods: {
			upload: function(config, callback) {
				var isOpportunityAttachment = config.entitySchemaName == "OpportunityFile";
				var canUploadFile = this.getIsCurrentStatusActive();
				if (isOpportunityAttachment && canUploadFile) {
					this.callParent(arguments);
				} else {
					Terrasoft.showErrorMessage("Current status is inactive, uploading restricted");
				}
			},
			getIsCurrentStatusActive: function() {
				var columnsValuesObject = this.sandbox.publish("GetColumnsValues", ["UsrInactiveStatus"], [this.sandbox.id]) || {};
				return columnsValuesObject.UsrInactiveStatus;
			},
		},
		diff: /**SCHEMA_DIFF*/[]
		/**SCHEMA_DIFF*/
	};
});

4) Refresh the page and chek the result.

 

As a result in case the value for the UsrInactiveStatus column is false, the upload method will return an error popup stating that the current stage is inactive and uploading files is restricted. You can also check it by displaying the UsrInactiveStatus checkbox on the page and enabling\disabling it (an opportunity record must be saved each time you enable to disable the checkbox).

Show all comments

Hello,



We try to use Locking edit page fields tool to lock a page with specific condition. 

When user opens the page from a Section (e.g. Orders), it works correctly - all fields and details are locked.

But when user opens the same page from a detail (e.g. Account/History/Orders) - all fields and details are not locked, so DisableControlsGenerator doesn't work



Does anyone has solution or idea how to fix this?



Thank you!

Like 2

Like

7 comments
Best reply

Try below code and let me know if it works. 

 

attributes: {

            "IsModelItemsEnabled": {

                "dataValueType": Terrasoft.DataValueType.BOOLEAN,

                "value": true

            },



onEntityInitialized: function() {

this.callParent(arguments);

                this.set("IsModelItemsEnabled", false);

            },

 

diff: /**SCHEMA_DIFF*/[

             {

                 "operation": "merge",

                "name": "CardContentWrapper",

                 "values": {

                     "generator": "DisableControlsGenerator.generatePartial"

                 }

             },

Hello,

 

I've run into a small test by displaying the configuration items detail on the contact page and by applying fields locking on the configuration item page. When opening the configuration item from the detail located on the contact page the fields are locked. So the issue is that the conditions that you use to lock the page are not working as they should.

Oleg Drobina,

We use no condition for the test on ContractPageV2:

 

        attributes: {

             "IsModelItemsEnabled": {

                 "dataValueType": Terrasoft.DataValueType.BOOLEAN,

                 "value": false

             },

 

    diff: /**SCHEMA_DIFF*/[

             {

                 "operation": "merge",

                "name": "CardContentWrapper",

                 "values": {

                     "generator": "DisableControlsGenerator.generatePartial"

                 }

             },

 

I've tested on demo environment with 3 sections: Contract, Document and custom Test section. The same result for all of them

Try below code and let me know if it works. 

 

attributes: {

            "IsModelItemsEnabled": {

                "dataValueType": Terrasoft.DataValueType.BOOLEAN,

                "value": true

            },



onEntityInitialized: function() {

this.callParent(arguments);

                this.set("IsModelItemsEnabled", false);

            },

 

diff: /**SCHEMA_DIFF*/[

             {

                 "operation": "merge",

                "name": "CardContentWrapper",

                 "values": {

                     "generator": "DisableControlsGenerator.generatePartial"

                 }

             },

Vladimir Sokolov,

 

I was also able to reproduce it for Contracts, will contact our R&D department for clarifications and return to you once I receive any feedback from them.

Nishit Singla,

Thank you! This works

Oleg Drobina,

Besides, I've found, that this doesn't lock 'Connected to' fields in Document:

Show all comments

Hi!

I would like to know if I can make a stage of a DCM lifecycle non editable by using business rule. When the stage is inactive, I want the owner to not be able to change it.

 

Thank you! 

Like 0

Like

5 comments

Hello,

 

You may lock the lead stage from manual selection in DCM settings and set up the business rule to lock it

How can I lock a stage using a business rule?

Hello!



The Case Designer section controls the DCM stage's availability.

You can learn about the Case Designer section in this article on the Creatio Academy:

https://academy.creatio.com/docs/user/bpm_tools/dynamic_case_setup/case…

You can also use a business rule to show or hide columns based on lead stages on a page.

Bogdan,

How, please, have you some samples or article?. I want to block DCM until some conditions in the record are done and not idea how to do

Julio Falcon (Cibernética),

 

I am sending you a link to an article on building business rules, for your familiarization: https://academy.creatio.com/docs/user/nocode_platform/freedom_business_…

 

Also, you may find this article from Community with a similar query useful: https://community.creatio.com/questions/lock-lead-record-edition

 

Show all comments

Hello,

 

Do we have the possibility of locking fields for editing, in the Auto generate page? PFA screenshot.

 

Product is Service Creatio - Customer Center edition

version 7.16

File attachments
Like 0

Like

1 comments

Hello,

 

For these purposes, it is recommended to use [Pre-configured page] process element instead of Auto-generated page as pre-configured page is much more easier to set up.

 

Best regards,

Bogdan S.

Show all comments