Question

Custom Action Menu Items are not always shown

Hello!

My question concerns the action menu items on the case edit page. I'm trying to add a custom action item that is only shown when some specific requirements are fulfilled. At the moment I basically use the following code:

 

		attributes: {
            "UsrIsMatchingTicket" : {
                "dataValueType": Terrasoft.DataValueType.BOOLEAN,
                "value": false
            }
        },
.....
		methods: {
            onEntityInitialized: function() {
                this.callParent(arguments);
                var esq = Ext.create("Terrasoft.EntitySchemaQuery", .....) // some longer query that in the end sets the attribute "UsrIsMatchingTicket" to true or false, depending on the query
            },
            getActions: function() {
				var actionMenuItems = this.callParent(arguments);
				actionMenuItems.addItem(this.getButtonMenuItem({
					"Tag": "doSomething",
                    "Caption": "Do Something",
                    "Visible": {bindTo: "UsrIsMatchingTicket"},
				}));
				return actionMenuItems;
			},
        }

This code works only, when I've opened the case and then reload. However, when I'm in the cases section and then click on a specific case, the action item is never shown, even when the attribute "UsrIsMatchingTicket" is set to true. Where is the problem in this code?

Like 0

Like

2 comments
Best reply

It sounds like you've added the custom action to the edit page only and not the case section also. When viewing the record from the section, you're in combined mode and the action menu belongs to the section in that scenario. You need to add the custom action to both the edit page (so it shows when the case is opened in edit mode, such as from the case detail) as well as the section page (so it shows when the case is opened in combined mode, such as from the section list).

See this for complete details: https://academy.creatio.com/docs/developer/front-end_development/creati…

Ryan

It sounds like you've added the custom action to the edit page only and not the case section also. When viewing the record from the section, you're in combined mode and the action menu belongs to the section in that scenario. You need to add the custom action to both the edit page (so it shows when the case is opened in edit mode, such as from the case detail) as well as the section page (so it shows when the case is opened in combined mode, such as from the section list).

See this for complete details: https://academy.creatio.com/docs/developer/front-end_development/creati…

Ryan

Ryan Farley,

Thank you for the explanation and the pointer to the documentation, I think I can solve the problem now. =) Thanks!

Show all comments