Question

How to lock the Stage bar (green bar on top of the page) for a read only record

Hi, 

 

I have successfully locked a page using this article: https://academy.creatio.com/docs/developer/interface_elements/interface…

However, the stage bar is still enabled when the attribute IsModelItemsEnabled is set to false. 

How can I disable the stage bar based on that attribute?

 

Thanks,

Jose

Jose

Like 0

Like

4 comments

Hi Jose,

 

You need to override the setActionsEnabled method in you section SectionActionsDashboard schema in the following manner:

setActionsEnabled: function(actions) {
				const isFeatureEnabled = Terrasoft.Features.getIsEnabled("YourFeatureCodeHere");
				if (isFeatureEnabled) {
					this.iterateActions(actions, function(action) {
					action.set("Enabled", false);
				}, this);
					return;
				}
				this.callParent(arguments);
			}

As a result no one will be able to change the stage from the UI.

 

Best regards,

Oscar

Oscar Dylan,

Hi Oscar,

 

I'm not sure where to add that code as I cannot make changes or replace the SectionActionsDashboard. Also, I need to unable or disable the bar based on the schema page IsModelItemsEnabled attribute that is set true or false on the onEntityInitialized function based on conditions on the page (e.g. Locked by field populated and equal to current user, status != 'Processed', etc. )

 

Thanks,

Jose

Jose Hernandez,

 

Hi,

 

You can replace the SectionActionsDashboard module for your section and you can put the code in the replaced module (every OOB section with actions dashboard has its own SectionActionsDashboard, like OpportunityActionsDashboard or CaseSectionActionsDashboard, take a look at the app configurations please). In case you have a custom section and you need some additional logic in the action dashboard of this section your can create your section actions dashboard based on the SectionActionsDashboard (selected as a parent) and then this custom actions dashboard can be connected to the page (see how it's developed for the LeadSectionActionsDashboard and added to the BaseLeadPage).

 

Secondly, you can create a logic of sending sandbox messages between modules as described in this example (in your case it should be SectionActionsDashboard module and your record page module) or you can see that a message is used in the base LeadSectionActionsDashboard.

 

Best regards,

Oscar

Oscar Dylan,

Thanks Oscar. I was able to disable the bar based on the attribute following your suggestions.

Show all comments