Good day, I have a question regarding the tabs in Classic UI. I want to make them disabled, or locked or unclickable in my edit page. If you know how to implement it please could you show it in the following code snippet:

                "operation": "insert",
                "name": "AgbPrimaryDataTab",
                "values": {
                    "caption": {
                        "bindTo": "Resources.Strings.AgbPrimaryDataTabCaption"
                    },
                    "items": [],
                    "order": 0
                },
                "parentName": "Tabs",
                "propertyName": "tabs",
                "index": 2
 
Like 0

Like

1 comments

Hello Behruzbek, 

If you don't want some users to see the existing tabs, use the following article to hide tabs by code based on different conditions.

Also, it's possible to add business rules for some users. Please note that adding the role to the business rule is impossible for now.

Best regards, 

Anhelina!

Show all comments

As the title says, we sometimes need to disable buttons while still showing them - something which was easy to do in Classic UI. Is there any way of doing so in Freedom UI? I can't see any examples in OOTB Freedom UI areas, anywhere that does have disabled buttons OOTB are in Classic UI sections (e.g. the "Finish session" button on the System User page on the Access Rules tab when no record is selected).

Like 1

Like

4 comments
Best reply

Classic UI buttons have a property 'enabled'
Freedom UI buttons have a property 'disabled'

Hi Harvey, 

Does it not work to bind an attribute to the enabled property of a button and set as true/false? I've not tried that, but I assume it would work? Have you already tried that?

Ryan

Classic UI buttons have a property 'enabled'
Freedom UI buttons have a property 'disabled'

Huh, not sure how I missed that, could've sworn I tried doing that! Thanks both.

As a note, the only way I could find to put some kind of hint/tooltip on the button when it's disabled is by using the "title" property, which gives you a standard browser tooltip display when hovering the mouse over the button. And binding that to an attribute that you change to be blank when the button is enabled.

Show all comments

Hi,

 

I'm trying to disable the 'Do not use' Options from the Contact Communication option detail.

Does anybody know how I can do this or where can I find it?

 

I know that if I want to disable the 'Home Phone' option I only need to change it from this lookup, but I cannot find the 'Do not' option in here.

 

Thank you!

Like 1

Like

1 comments

Hello,

 

This task is harder than disabling the option from the lookup. The method that generates the restrict option is getRestrictionsMenuItem in the ContactCommunicationDetail schema. If you need to remove one of the "Do not use" options from the menu, you need to override the logic of this method.

Show all comments



I have added a custom button called "Confirm Audience" to a detail and it's working fine. but in the meantime, I need to disable the button once I click on it. So far I tried to disable it using an attribute, which is mentioned in this article.

https://community.creatio.com/questions/how-can-i-disable-button-once-clicked



While implementing that scenario I am facing an issue which is when we reload the page or go back and come back to the same record, the button behavior will be going back to its default behavior. If there is a way to achieve this please help me on this.

And this is how I added the button to my schema.



 

diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "ConfirmAudienceButton",
				"parentName": "Detail",
				"propertyName": "tools",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {"bindTo": "Resources.Strings.BEACSConfirmButtonCaption"},
					"click": {"bindTo": "onConfirmButtonClick"}, //method to trigger the button
					"style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
					"visible": {"bindTo": "getIsConfirmAudienceEnabled"}
				}
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onConfirmButtonClick: function() {
				var recordID = this.values.MasterRecordId;
				var confirmAudienceBoolean = this.values.MasterRecordId.BEACSConfirmAudience;
				var args = {
					sysProcessName: "BEACSProcess_1df603c",
					parameters: {
						ProcessSchemaRecordId:recordID,
					}
				};
				ProcessModuleUtilities.executeProcess(args);
				this.set("isConfirmButtonClicked",false);
			},
			getIsConfirmAudienceEnabled: function() {
				return !this.$IsGridEmpty;
			},
		}

 

Like 0

Like

4 comments
Best reply

Lakindu Yasomith,

 

I am sorry for assuming that the result of the click would have other visible changes in local conditions that were not mentioned.

Since now we have the only possible condition of the button - it is either clicked or not - the only solution would be adding a global boolean variable (a checkbox) to the object that would be stored in the DB.

 

We can imagine that the column would be UsrButtonIsClicked.

You would be able to check it using this.UsrButtonIsClicked or method to call query handler "await". Please see an example by the link below:

https://academy.creatio.com/docs/developer/front_end_development_freedo…

 

Note that logic of updating this value in the database as onClick is triggered would be also required.

 

Best Regards,

Denys

Hello Lakindu,

 

In your example, the attribute "IsButtonEnabled" is true when defined.

 

attributes: {
    "IsButtonEnabled": {
		dataValueType: Terrasoft.DataValueType.BOOLEAN,
		type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
		value: true
	}
}

There are some options.

 

1) First one is to use local conditions, already available on the page by setting the value to this attribute in the onEntityInitialized method:

methods: {
			onEntityInitialized: function() {
				this.callParent(arguments);
				this.setIsButtonEnabled();
			},
			setIsButtonEnabled: function() {
				if (YOUR CONDITION) {
					this.set("IsButtonEnabled", true);
				}
				else this.set("IsButtonEnabled", false);
			}
		},

2) If you want to make this condition global for all users - you would need to use DataBase. For example, add a new boolean column to the connected object (It is not necessary to display this column on any page, it may just exist in the background). Read and update the value to determine if the button is visible or not.

 

Best Regards,

Dan

Hi Denis,

 I really appreciate your reply but I'm afraid you clearly didn't understand my question here. I'm asking how to disable or hide the button once the button is CLICKED. where you also mentioned "YOUR CONDITION". what I want is that "your condition" part.



Kind Regards,

Lakindu

Lakindu Yasomith,

 

I am sorry for assuming that the result of the click would have other visible changes in local conditions that were not mentioned.

Since now we have the only possible condition of the button - it is either clicked or not - the only solution would be adding a global boolean variable (a checkbox) to the object that would be stored in the DB.

 

We can imagine that the column would be UsrButtonIsClicked.

You would be able to check it using this.UsrButtonIsClicked or method to call query handler "await". Please see an example by the link below:

https://academy.creatio.com/docs/developer/front_end_development_freedo…

 

Note that logic of updating this value in the database as onClick is triggered would be also required.

 

Best Regards,

Denys

Thank you for your response. This is helpful

Show all comments

Hello fellow creators! I have problems with extending BaseSectionV2 schema. I want to disable View button , so I  created a replacing module of BaseSectionV2 and wrote some code, but it's not working. Any advice would be much appreciated

 define("BaseSectionV2",[],function(){
	 return {
		 entitySchemaName:"Base",
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
				{
					"operation": "merge",
					"name": "AnalyticsModeViewOptionsButton",
					"parentName": "AnalyticsModeActionButtonsRightContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": { "bindTo": "Resources.Strings.ViewOptionsButtonCaption"},
						"enabled": { "bindTo": "checkIsAdmin"},
					 }
				}
 
		 ]/**SCHEMA_DIFF*/
	 };
  });
File attachments
Like 0

Like

2 comments
Best reply

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Dmytro Vovchenko,

Thanks a lot! It worked!

Show all comments

How to disable the Select All button on Modal dialog box?

Like 0

Like

4 comments

Kindly Suggest

Roman Rak,

 

Thanks Roman but the links are referring to the section objects. I want to disable the Action Item(Select All) in Lookup Config - please find the screenshot added in the current post.

 

I have tried by overriding the getSelectionControlsConfig and getActionsMenuConfig from LookupPageViewGenerator schema module but it looks like the method is not getting executed.

Kindly suggest

 

 

Hello Anupama,

 

Thank you for your reply. 

If to talk about a selection card from a lookup,  the getSelectionControlsConfig method in the LookupPageViewGenerator. The BaseLookupPageV2 scheme is responsible for this page/window. For example, previously the Add button was called: SeparateModeAddRecordButton, the ActionsButton is action button, etc.. You can override and customize the visibility of these buttons as you need.

 

Here are some examples as well:

Kind regards,

Roman

Show all comments

In an edit page, we have fields that can be changed by the user or calculated by the page Javascript code, depending on specific circunstamces.

In this case we need to inhibit the attribute dependency method call, to make sure it is not called when the field is calculated by the page code, and not by the user.

Is it possible ?

Regards,

Like 0

Like

3 comments

Hi Ricardo,

 

Everything is simple - these specific circumstances should be included into the logic of custom method calls inside the JavaScript code. So the logic itself should be redesigned.

 

Best regards,

Oscar

Oscar Dylan,

Ok, but what I am looking for is a way of disabling the handler method activation in the attribute dependency, so that when the field is updated by the code the handler method will not be triggered... The Javascript code would first disable the dependency method call, update the field, and then enable the dependency control again.

Ricardo Bigio,

One way to accomplish that is to add a property or attribute to the code where you can set a flag that the field is being updated via code, then in the event handler, check this flag to see if you should exit or continue The flag would only get set by code, so the user entering a value the flag won't be set and the event handler will trigger normally. Something like this:

suppressEvent: false,
 
funcThatSetsDependentColumn: function() {
    this.suppressEvent = true; // set flag to suppress the event
    this.set("UsrDependentColumn", value); // set the column that will trigger the event
},
 
dependentColChangeHandler: function() {
    // check if flag is set to suppress the event
    if (this.suppressEvent) {
        this.suppressEvent = false; // unset the flag and exit
        return;
    }
 
    // do other stuff in the event handler here
}

Hope this helps,

Ryan

Show all comments

Hi Team,



I would like to apply the "enabled" property to active row buttons COPY & DELETE in  contact section.



 

I have tried the below code but it doesn't work.

{
		"operation": "merge",
		"name": "DataGridActiveRowCopyAction",
		"values": {
		//"enabled": {bindTo: "ShowButtonforAdmin"},
		"enabled": false,
		}
},
{
		"operation": "merge",
		"name": "DataGridActiveRowDeleteAction",
		"values": {
		//"enabled": {bindTo: "ShowButtonforAdmin"},
		"enabled": false,
		}
},

 

 

Kindly guide me to achieve the Enable/Disable operation in active row buttons of contact section (COPY & DELETE).



Thanks in advance!

 

 

 

Best Regards,

Bhoobalan P.

Like 0

Like

4 comments

Hi Bhoobalan, 

 

please use "visible" : false

 

instead of 

"enabled": false

and the button will be hidden.

 

Best Regards, 

 

Bogdan L.

Bogdan Lesyk,



Thanks much for the response!



Yes, I have tried with visible and its working but I wanted to Disable the button for few users. The button should be displayed and disabled.





Could you please guide on achieving it?

Bhoobalan Palanivelu,

 

I'm not sure that it's possible and we don't have practical examples of such implementation using js code.

 

However, the best way to achieve it will be setting up the Object permission, it will be much easier for you and best in terms of implementation: 

 

 

Regards, 

 

Bogdan L.

 

Bogdan Lesyk,



Thanks, This OBJECT permission is OOTB and it works.

I tried to depict the button to user as disabled and to inform/give an idea as that this button is not available to click.



Thanks,

Bhoobalan P.

Show all comments