Hi all,

 

I'm trying to migrate a package from our dev site to production.



We have multiple metric widgets on one of the pages and these are not migrating with the package (only their placeholders in the diff).



Can anybody advise what needs to be bound to the package to ensure these elements migrate across?



Nb. Version is up-to-date but we are not using the Freedom UI.

Like 0

Like

1 comments
Best reply

The metric definition is stored in SysWidgetDashboard. 

 

You’ll need to locate the row and bind the data to your package. The page code will contain the Id for  the record. 

The metric definition is stored in SysWidgetDashboard. 

 

You’ll need to locate the row and bind the data to your package. The page code will contain the Id for  the record. 

Show all comments

after adding ssl the websocket in pending status

 

Like 0

Like

1 comments

Greetings,



We kindly ask you to contact us via email at support@creatio.com for an in-depth analysis of your error.

Show all comments

I am trying to create a new section in a different workplace with an existing object. The Package is from my "Invoices" object, which has all the material I need; however, anytime I try to access this via the New: Section wizard, "SELECT EXISTING OBJECT", I get the error, "Section for this object already exists."



I am having an increasingly hard time maneuvering through the customization of Creatio no-code, without being directed to use schemas, SQL, or outdated object-relational mapping.

Like 1

Like

1 comments

Hello,

 

Indeed, in Creatio, creating multiple sections for one object is impossible. You either need to remove existing sections or create a new object for the new section.

Show all comments

Hi Community,

 

We are using the case section with 4 different pages based on the case types. We are required to disable the creation permission for different page types based on the user roles.

The OOTB Operation permission functionality in the object permission allows the Restriction at the object level. However, according to the requirement, we require this permission at the page level. Is there any workaround for us to achieve this?

 

I also tried the code attached below to achieve this requirement. But seems like I am missing something and the code is not working as expected.

 

initEditPages: function () {
    var roleName = "System administrators";
 
    var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
        rootSchemaName: "SysUserInRole"
    });
    esq.addColumn("SysRole");
 
    esq.filters.add("UserFilter", Terrasoft.createColumnFilterWithParameter(
        Terrasoft.ComparisonType.EQUAL, "SysUser", Terrasoft.SysValue.CURRENT_USER.value
    ));
 
    esq.filters.add("RoleFilter", Terrasoft.createColumnFilterWithParameter(
        Terrasoft.ComparisonType.EQUAL, "SysRole.Name", roleName
    ));
 
    esq.getEntityCollection(function(result) {
        if (!result.success || result.collection.getItems().length === 0) {
            // the user is *not* in the role 
            // do something here if needed
        }
        else {
            // the user *is* in the role
            var scope = this;
            var Ext = this.Ext;
            var Terrasoft = this.Terrasoft;
            var collection = Ext.create("Terrasoft.BaseViewModelCollection");
            var entityStructure = this.getEntityStructure(this.entitySchemaName);
            if (entityStructure) {
                Terrasoft.each(entityStructure.pages, function(editPage) {
                    var typeUId = editPage.UId || Terrasoft.GUID_EMPTY;
                    if (editPage.cardSchema === "BEACRCase2Page") {
                        collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
                            values: {
                                Id: typeUId,
                                Caption: editPage.caption,
                                Click: {bindTo: "addRecord"},
                                Tag: typeUId,
                                SchemaName: editPage.cardSchema
                            }
                        }));
                    }
                    else if (editPage.cardSchema === "BEACRCase1Page") {
                        collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
                            values: {
                                Id: typeUId,
                                Caption: editPage.caption,
                                //Click: {bindTo: "addRecord"},
                                Tag: typeUId,
                                SchemaName: editPage.cardSchema
                            }
                        }));
                    } else if (editPage.cardSchema === "BEACCCase1Page") {
                        collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
                            values: {
                                Id: typeUId,
                                Caption: editPage.caption,
                                //Click: {bindTo: "addRecord"},
                                Tag: typeUId,
                                SchemaName: editPage.cardSchema
                            }
                        }));
                    } else if (editPage.cardSchema === "BEAKRCase1Page") {
                        collection.add(typeUId, Ext.create("Terrasoft.BaseViewModel", {
                            values: {
                                Id: typeUId,
                                Caption: editPage.caption,
                                //Click: {bindTo: "addRecord"},
                                Tag: typeUId,
                                SchemaName: editPage.cardSchema
                            }
                        }));
                    }
                }, scope);
            }
            this.set("EditPages", collection);
        }
    }, this);
},

 

Kindly assist me in resolving this issue, please.

Like 0

Like

4 comments

Hello,

 

1) If you need to check roles and grant them access to some functionality it's much better to do via operations permissions check.

2) Because of point 1 you need to create several operation permissions and check all of them using RightUtilities.checkCanExecuteOperation method.

3) Based on the check result from point 2 - remove edit pages from the collection of edit pages. To do that:

 

3.1) Override SeparateModeAddRecordButton in the section schema

3.2) Add the check like the following:

{
				"operation": "merge",
				"name": "SeparateModeAddRecordButton",
				"parentName": "SeparateModeActionButtonsLeftContainer",
				"propertyName": "items",
				"values": {
					"controlConfig": {
						"menu": {
							"items": {
								"bindTo": "EditPages",
								"bindConfig": {
									"converter": function(editPages) {
										if (editPages.getCount() > 1) {
											RightUtilities.checkCanExecuteOperation({operation: "CanCreateCustomerContact"}, function(result) {
												if (result) {
													editPages.collection.items = editPages.collection.items.filter(item => item.values.Caption.includes("Customer"));
													return editPages;
												}
 
											});
										} else {
											return null;
										}
									}
								}
							}
						}
					}
				}
			}

It will also check if the role of the current user is in the operation permission and you don't need to call ESQ to get the list of roles, you can control it directly via the "Operation permissions" section.

 

In the example above all edit pages but "Customer" will be removed from the list if the user has access to the "CanCreateCustomerContact" operation (for all other users the "New" button in the Contacts section won't do anything).

 

So you need to test this approach and apply it to your business task.

Hi Oleg,

 

I appreciate your support. Please see the steps below, that were executed. I seem to be missing something and cannot see the expected result.

 

1. Step 01:

Created a new operation permission with the code - "CanCreatePendingDocumentCase" and added the relevant user roles who can create the particular type of case (Pending Document)

 

2. Step 02:

Added the below code snippet in the replacing section schema in the diff array

{
                "operation": "merge",
                "name": "SeparateModeAddRecordButton",
                "parentName": "SeparateModeActionButtonsLeftContainer",
                "propertyName": "items",
                "values": {
                    "controlConfig": {
                        "menu": {
                            "items": {
                                "bindTo": "EditPages",
                                "bindConfig": {
                                    "converter": function(editPages) {
                                        if (editPages.getCount() > 1) {
                                            RightUtilities.checkCanExecuteOperation({operation: "CanCreatePendingDocumentCase"}, function(result) {
                                                if (result) {
                                                    editPages.collection.items = editPages.collection.items.filter(item => item.values.Caption.includes("Pending Document"));
                                                    return editPages;
                                                }
                                            });
                                        } else {
                                            return null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

 

Step 03:

Cleared the cache and checked whether only pending document case is available in the new button drop-down of the section.

 

But the dropdown is showing all the case types in the new button regardless of the user role.

Geeviniy Vazavan,



1) Is the Edit page called "Pending Document" (with this uppercase in P and D)? Includes method is case sensitive in JS.

 

2) which result is passed to the result of checkCanExecuteOperation method execution?

 

3) Have you added the button to the correct schema (for example it should be in ContactSectionV2, not in the ContactPageV2)?

 

4) Is the converted code triggered in the debugger?

Hi Oleg,

 

Please see the answers below.

 

1. Yes. The edit page "Pending Document" is in upper case P and D.

2. Result is "true"

3. It is added to the "CaseSection" schema

4. Yes. It is triggered.

Show all comments
Question
Like 0

Like

1 comments

Hello,

 

In this article it's shown that during the render method execution we've created a component in DOM

const component = document.createElement("angular-element-component");

In initDomEvents method the "this" context represents the DOM itself and using "this.component" you retrieve the component and add a click action to this component.

Show all comments

Good day!

 

The report is generated in Word format.

Website version 7.18.5

Screenshot attached

 

In one of our tables, we have several products linked to a specific Id. Each product is associated with its unique point of inclusion address. The product names are successfully pulled and correctly displayed in the report table - each name in a separate line, which fully meets our requirements. We set this up through the table part report settings.

 

The problem arises with the addresses of the points of inclusion, the values for which we obtain using a macro. In the current configuration, all addresses for the three products are collected and displayed in one line of the table, instead of being located in the corresponding lines opposite each product.

 

Question:

Could you advise on how we might modify the macro or the process of its operation so that the addresses of the points of inclusion are placed in separate cells of the table in accordance with each product?

File attachments
Like 0

Like

1 comments

Hello,

 

Could you please provide us with an example of the macro you are using?

Please provide the table settings, and also take a screenshot of how this table looks specifically in the printable template in word plugin.

Show all comments

Hi Creatio Community,

 

I've been trying to create custom Actions dropdown button (not FreedomUI) and I can't seem to be able to find working documentation for it or get something similar to it.  Would like your help for it.





 

Here are a couple of documentations I've tried out (First one is not working while the second one isn't exactly what we want):

 

1. https://community.creatio.com/questions/add-custom-buttons-actionbutton…



2. https://community.creatio.com/articles/how-create-and-popualte-drop-dow…

 

Thanks in advance.

 

Regards,

Abilash.S

Like 0

Like

3 comments
Best reply

Abilash,

 

Hi,

 

The task is to copy the logic of the existing "Actions" button and apply the same to the custom button. To do that (tested in the "Opportunity" section):

 

1) In the OpportunitySectionV2 section schema:

 

1.1) Add the CombinedModeCustomActionsButtonMenuItems attribute of the "Collection" dataValueType (Terrasoft.DataValueType.COLLECTION). The example is CombinedModeActionsButtonMenuItems from BaseDataView.

1.2) Create a PTP "GetCardActionsCustom" message with the SUBSCRIBE direction (as done on the BasePageV2)

1.3) In the subscribeSandboxEvents method subscribe to the "GetCardActionsCustom" message and trigger the initCustomActionButtonMenu method when the "GetCardActionsCustom" message is received (as done for the "GetCardActions" message on the BasePageV2)

1.4) Create an extension of the _initCollections method (as done for the basic "Actions" button)

1.5) Add an empty prepareCustomActionsButtonMenuItems function to methods (as done for prepareActionsButtonMenuItems method in BaseDataView)

1.6) Add the initCustomActionButtonMenu method which is a handler for the "GetCardActionsCustom" message (as done with the initActionButtonMenu method from BaseDataView).

1.7) Add the button itself to the diff array

 

The complete schema of OpportunitySectionV2:

define("OpportunitySectionV2", [], function() {
	return {
		entitySchemaName: "Opportunity",
		attributes: {
 
			"CombinedModeCustomActionsButtonMenuItems": {
				dataValueType: Terrasoft.DataValueType.COLLECTION
			}
		},
		messages: {
 
			"GetCardActionsCustom": {
				mode: Terrasoft.MessageMode.PTP,
				direction: Terrasoft.MessageDirectionType.SUBSCRIBE
			}
		},
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "CustomActionsButton",
				"parentName": "CombinedModeActionButtonsCardLeftContainer",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {"bindTo": "Resources.Strings.CustomActionsButtonCaption"},
					"classes": {
						"textClass": ["actions-button-margin-right"],
						"wrapperClass": ["actions-button-margin-right"]
					},
					"prepareMenu": {"bindTo": "prepareCustomActionsButtonMenuItems"},
					"menu": {"items": {"bindTo": "CombinedModeCustomActionsButtonMenuItems"}}
				}
			},
		]/**SCHEMA_DIFF*/,
		methods: {
 
			subscribeSandboxEvents: function() {
				this.callParent(arguments);
				const cardModuleSandboxId = this.getCardModuleSandboxId();
				this.sandbox.subscribe("GetCardActionsCustom", function(actionMenuItems) {
					this.initCustomActionButtonMenu("Combined", actionMenuItems);
				}, this, [cardModuleSandboxId]);
			},
 
			prepareCustomActionsButtonMenuItems: Ext.emptyFn,
 
			_initCollections: function() {
				this.callParent(arguments);
				this.set("CombinedModeCustomActionsButtonMenuItems", this.Ext.create("Terrasoft.BaseViewModelCollection"));
			},
 
			initCustomActionButtonMenu: function(modeType, actionMenuItems) {
				const collectionName = modeType + "ModeCustomActionsButtonMenuItems";
				const collection = this.get(collectionName);
				if (actionMenuItems.getCount()) {
					this.set(modeType + "ModeActionsButtonVisible", true);
					const newCollection = this.Ext.create("Terrasoft.BaseViewModelCollection");
					actionMenuItems.each(function(item) {
						newCollection.addItem(item);
					}, this);
					if (collection) {
						collection.clear();
						collection.loadAll(newCollection);
					} else {
						this.set(collectionName, newCollection);
					}
				} else {
					this.set(modeType + "ModeActionsButtonVisible", false);
				}
			},
		}
	};
});

2) In OpportunityPageV2:

 

2.1) Create the "GetCardActionsCustom" message (as done for the "GetCardActions" existing message)

2.2) In the init method call the initCustomActionButtonMenu method

2.3) Create the initCustomActionButtonMenu method (as done for the initActionButtonMenu in BasePageV2)

2.4) Create the getCustomActions method (as done with the getActions method in the basic OpportunityPageV2 with only difference that you don't need to call parent method but create an instance of the Terrasoft.BaseViewModelCollection here)

2.5) Add the button itself to the diff array

 

The complete code is:

define("OpportunityPageV2", [], function() {
	return {
		entitySchemaName: "Opportunity",
		attributes: {},
		messages: {
			"GetCardActionsCustom": {
				mode: this.Terrasoft.MessageMode.PTP,
				direction: this.Terrasoft.MessageDirectionType.PUBLISH
			}
		},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{
			"UsrSchemaf6483d73Detaile560e0a4": {
				"schemaName": "UsrSchemaf6483d73Detail",
				"entitySchemaName": "UsrOppTestDet",
				"filter": {
					"detailColumn": "UsrOpportunity",
					"masterColumn": "Id"
				}
			}
		}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
 
			init: function() {
				this.callParent(arguments);
				this.initCustomActionButtonMenu();
			},
 
			initCustomActionButtonMenu: function() {
				this.publishPropertyValueToSection("IsCardInEditMode", this.isEditMode());
				var actionMenuItems = this.getCustomActions();
				var actionsButtonVisible = !actionMenuItems.isEmpty();
				this.set("CustomActionsButtonVisible", actionsButtonVisible);
				this.set("CustomActionsButtonMenuItems", actionMenuItems);
				this.sandbox.publish("GetCardActionsCustom", actionMenuItems, [this.sandbox.id]);
			},
 
			getCustomActions: function() {
				var actionMenuItems = this.Ext.create("Terrasoft.BaseViewModelCollection");
				actionMenuItems.addItem(this.getButtonMenuItem({
					"Caption": {"bindTo": "Resources.Strings.CustomButtonCaption"},
					"Tag": "clickCustomButton"
				}));
				return actionMenuItems;
			}
		},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"parentName": "LeftContainer",
				"propertyName": "items",
				"name": "actions",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {"bindTo": "Resources.Strings.CustomButtonCaption"},
					"classes": {
						"textClass": ["actions-button-margin-right"],
						"wrapperClass": ["actions-button-margin-right"]
					},
					"menu": {
						"items": {"bindTo": "CustomActionsButtonMenuItems"}
					},
					"visible": {"bindTo": "CustomActionsButtonVisible"}
				}
			},
			{
				"operation": "merge",
				"name": "MetricsContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityClient",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 1
					}
				}
			},
			{
				"operation": "remove",
				"name": "OpportunityClient",
				"properties": [
					"tip"
				]
			},
			{
				"operation": "merge",
				"name": "LablelMetricsContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantProfileHeaderContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantIcon",
				"values": {
					"layout": {
						"colSpan": 5,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantHeaderCaption",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 5,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityBudget",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 1
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityDecisionMaker",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityLeadType",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 3
					}
				}
			},
			{
				"operation": "move",
				"name": "OpportunityLeadType",
				"parentName": "BantProfile",
				"propertyName": "items",
				"index": 3
			},
			{
				"operation": "merge",
				"name": "OpportunityDueDate",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "ESNTab",
				"values": {
					"order": 8
				}
			},
			{
				"operation": "merge",
				"name": "GeneralInfoTab",
				"values": {
					"order": 0
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityTitle",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "Amount",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 3
					}
				}
			},
			{
				"operation": "merge",
				"name": "ResponsibleDepartment",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 3
					}
				}
			},
			{
				"operation": "move",
				"name": "ResponsibleDepartment",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 3
			},
			{
				"operation": "merge",
				"name": "Probability",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "Owner",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "Category",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 5
					}
				}
			},
			{
				"operation": "merge",
				"name": "Source",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 5
					}
				}
			},
			{
				"operation": "merge",
				"name": "Type",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 6
					}
				}
			},
			{
				"operation": "move",
				"name": "Type",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 8
			},
			{
				"operation": "merge",
				"name": "CreatedOn",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 6
					}
				}
			},
			{
				"operation": "merge",
				"name": "Partner",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 7
					}
				}
			},
			{
				"operation": "merge",
				"name": "CloseReason",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 7
					}
				}
			},
			{
				"operation": "insert",
				"name": "DATETIME26d46360-17b4-45ee-acac-da084cf0aa67",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 8,
						"layoutName": "OpportunityPageGeneralBlock"
					},
					"bindTo": "UsrTestDateTime",
					"enabled": true
				},
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 12
			},
			{
				"operation": "merge",
				"name": "Description",
				"values": {
					"layout": {
						"colSpan": 23,
						"rowSpan": 1,
						"column": 1,
						"row": 0
					}
				}
			},
			{
				"operation": "insert",
				"name": "UsrSchemaf6483d73Detaile560e0a4",
				"values": {
					"itemType": 2,
					"markerValue": "added-detail"
				},
				"parentName": "GeneralInfoTab",
				"propertyName": "items",
				"index": 5
			},
			{
				"operation": "merge",
				"name": "LeadTab",
				"values": {
					"order": 4
				}
			},
			{
				"operation": "merge",
				"name": "TacticAndCompetitorTab",
				"values": {
					"order": 1
				}
			},
			{
				"operation": "merge",
				"name": "CheckDate",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "ProductsTab",
				"values": {
					"order": 2
				}
			},
			{
				"operation": "merge",
				"name": "HistoryTab",
				"values": {
					"order": 5
				}
			},
			{
				"operation": "merge",
				"name": "HistoryAccountTab",
				"values": {
					"order": 6
				}
			},
			{
				"operation": "merge",
				"name": "NotesTab",
				"values": {
					"order": 7
				}
			},
			{
				"operation": "move",
				"name": "IsPrimary",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 0
			}
		]/**SCHEMA_DIFF*/
	};
});

As a result when opening the page you will get a custom button with items:

Also forgot to metion that you need to add localizable strings:

 

1) For OpportunityPageV2

 

CustomButtonCaption with "Custom action" value

 

2) For OpportunitySectionV2

 

CustomButtonCaption with "Custom button" value

 

Hope this example help!

 

 

Hello,



Could you please write in more detail, regarding the first option that suits you, what exactly are the difficulties you encountered? 

Malika,

Hello, 



Currently, I'm just getting a button with no dropdown like this







Here's the code for it:





//I've tried two different approaches for the method (both didn't work) based on the above two documentation

methods: {





//approach1



prepareMyActionsButtonMenuItems: function(filter, list) {

                if (list === null) {

                    return;

                }

                list.clear();

                var columns = {};

 

                var value1 = {

                    displayValue: "a123",

                    value: "1"

                };

                var value2 = {

                    displayValue: "b234",

                    value: "2"

                };

                var value3 = {

                    displayValue: "c345",

                    value: "3"

                };

 

                columns[1] = value1;

                columns[2] = value2;

                columns[3] = value3;

 

                list.loadAll(columns);

            },



//approach 2



prepareMyActionsButtonMenuItems: function(){

                this.set("MyActionsButtonMenuItems", ["Sample", "test", "Test5"]);

            }



}





attributes: {



              "MyActionsButtonMenuItems": {

                dataValueType: Terrasoft.DataValueType.COLLECTION,

              }

}



diff:[

{

                "operation": "insert",

                "name": "MyActionsButton",

                "parentName": "RightContainer",

                "propertyName": "items",

                "values": {

                      "itemType": Terrasoft.ViewItemType.BUTTON,

                      "caption": "MyActionsButton",

                      "classes": {

                        "textClass": ["actions-button-margin-right"],

                        "wrapperClass": ["actions-button-margin-right"]

                      },

                      "prepareMenu": {"bindTo": "prepareMyActionsButtonMenuItems"},

                      "menu": {"items": {"bindTo": "MyActionsButtonMenuItems"}},

                      "visible": true

                }

              }

]

Abilash,

 

Hi,

 

The task is to copy the logic of the existing "Actions" button and apply the same to the custom button. To do that (tested in the "Opportunity" section):

 

1) In the OpportunitySectionV2 section schema:

 

1.1) Add the CombinedModeCustomActionsButtonMenuItems attribute of the "Collection" dataValueType (Terrasoft.DataValueType.COLLECTION). The example is CombinedModeActionsButtonMenuItems from BaseDataView.

1.2) Create a PTP "GetCardActionsCustom" message with the SUBSCRIBE direction (as done on the BasePageV2)

1.3) In the subscribeSandboxEvents method subscribe to the "GetCardActionsCustom" message and trigger the initCustomActionButtonMenu method when the "GetCardActionsCustom" message is received (as done for the "GetCardActions" message on the BasePageV2)

1.4) Create an extension of the _initCollections method (as done for the basic "Actions" button)

1.5) Add an empty prepareCustomActionsButtonMenuItems function to methods (as done for prepareActionsButtonMenuItems method in BaseDataView)

1.6) Add the initCustomActionButtonMenu method which is a handler for the "GetCardActionsCustom" message (as done with the initActionButtonMenu method from BaseDataView).

1.7) Add the button itself to the diff array

 

The complete schema of OpportunitySectionV2:

define("OpportunitySectionV2", [], function() {
	return {
		entitySchemaName: "Opportunity",
		attributes: {
 
			"CombinedModeCustomActionsButtonMenuItems": {
				dataValueType: Terrasoft.DataValueType.COLLECTION
			}
		},
		messages: {
 
			"GetCardActionsCustom": {
				mode: Terrasoft.MessageMode.PTP,
				direction: Terrasoft.MessageDirectionType.SUBSCRIBE
			}
		},
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "CustomActionsButton",
				"parentName": "CombinedModeActionButtonsCardLeftContainer",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {"bindTo": "Resources.Strings.CustomActionsButtonCaption"},
					"classes": {
						"textClass": ["actions-button-margin-right"],
						"wrapperClass": ["actions-button-margin-right"]
					},
					"prepareMenu": {"bindTo": "prepareCustomActionsButtonMenuItems"},
					"menu": {"items": {"bindTo": "CombinedModeCustomActionsButtonMenuItems"}}
				}
			},
		]/**SCHEMA_DIFF*/,
		methods: {
 
			subscribeSandboxEvents: function() {
				this.callParent(arguments);
				const cardModuleSandboxId = this.getCardModuleSandboxId();
				this.sandbox.subscribe("GetCardActionsCustom", function(actionMenuItems) {
					this.initCustomActionButtonMenu("Combined", actionMenuItems);
				}, this, [cardModuleSandboxId]);
			},
 
			prepareCustomActionsButtonMenuItems: Ext.emptyFn,
 
			_initCollections: function() {
				this.callParent(arguments);
				this.set("CombinedModeCustomActionsButtonMenuItems", this.Ext.create("Terrasoft.BaseViewModelCollection"));
			},
 
			initCustomActionButtonMenu: function(modeType, actionMenuItems) {
				const collectionName = modeType + "ModeCustomActionsButtonMenuItems";
				const collection = this.get(collectionName);
				if (actionMenuItems.getCount()) {
					this.set(modeType + "ModeActionsButtonVisible", true);
					const newCollection = this.Ext.create("Terrasoft.BaseViewModelCollection");
					actionMenuItems.each(function(item) {
						newCollection.addItem(item);
					}, this);
					if (collection) {
						collection.clear();
						collection.loadAll(newCollection);
					} else {
						this.set(collectionName, newCollection);
					}
				} else {
					this.set(modeType + "ModeActionsButtonVisible", false);
				}
			},
		}
	};
});

2) In OpportunityPageV2:

 

2.1) Create the "GetCardActionsCustom" message (as done for the "GetCardActions" existing message)

2.2) In the init method call the initCustomActionButtonMenu method

2.3) Create the initCustomActionButtonMenu method (as done for the initActionButtonMenu in BasePageV2)

2.4) Create the getCustomActions method (as done with the getActions method in the basic OpportunityPageV2 with only difference that you don't need to call parent method but create an instance of the Terrasoft.BaseViewModelCollection here)

2.5) Add the button itself to the diff array

 

The complete code is:

define("OpportunityPageV2", [], function() {
	return {
		entitySchemaName: "Opportunity",
		attributes: {},
		messages: {
			"GetCardActionsCustom": {
				mode: this.Terrasoft.MessageMode.PTP,
				direction: this.Terrasoft.MessageDirectionType.PUBLISH
			}
		},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{
			"UsrSchemaf6483d73Detaile560e0a4": {
				"schemaName": "UsrSchemaf6483d73Detail",
				"entitySchemaName": "UsrOppTestDet",
				"filter": {
					"detailColumn": "UsrOpportunity",
					"masterColumn": "Id"
				}
			}
		}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
 
			init: function() {
				this.callParent(arguments);
				this.initCustomActionButtonMenu();
			},
 
			initCustomActionButtonMenu: function() {
				this.publishPropertyValueToSection("IsCardInEditMode", this.isEditMode());
				var actionMenuItems = this.getCustomActions();
				var actionsButtonVisible = !actionMenuItems.isEmpty();
				this.set("CustomActionsButtonVisible", actionsButtonVisible);
				this.set("CustomActionsButtonMenuItems", actionMenuItems);
				this.sandbox.publish("GetCardActionsCustom", actionMenuItems, [this.sandbox.id]);
			},
 
			getCustomActions: function() {
				var actionMenuItems = this.Ext.create("Terrasoft.BaseViewModelCollection");
				actionMenuItems.addItem(this.getButtonMenuItem({
					"Caption": {"bindTo": "Resources.Strings.CustomButtonCaption"},
					"Tag": "clickCustomButton"
				}));
				return actionMenuItems;
			}
		},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"parentName": "LeftContainer",
				"propertyName": "items",
				"name": "actions",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {"bindTo": "Resources.Strings.CustomButtonCaption"},
					"classes": {
						"textClass": ["actions-button-margin-right"],
						"wrapperClass": ["actions-button-margin-right"]
					},
					"menu": {
						"items": {"bindTo": "CustomActionsButtonMenuItems"}
					},
					"visible": {"bindTo": "CustomActionsButtonVisible"}
				}
			},
			{
				"operation": "merge",
				"name": "MetricsContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityClient",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 1
					}
				}
			},
			{
				"operation": "remove",
				"name": "OpportunityClient",
				"properties": [
					"tip"
				]
			},
			{
				"operation": "merge",
				"name": "LablelMetricsContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantProfileHeaderContainer",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantIcon",
				"values": {
					"layout": {
						"colSpan": 5,
						"rowSpan": 1,
						"column": 0,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "BantHeaderCaption",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 5,
						"row": 0
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityBudget",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 1
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityDecisionMaker",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityLeadType",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 3
					}
				}
			},
			{
				"operation": "move",
				"name": "OpportunityLeadType",
				"parentName": "BantProfile",
				"propertyName": "items",
				"index": 3
			},
			{
				"operation": "merge",
				"name": "OpportunityDueDate",
				"values": {
					"layout": {
						"colSpan": 19,
						"rowSpan": 1,
						"column": 5,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "ESNTab",
				"values": {
					"order": 8
				}
			},
			{
				"operation": "merge",
				"name": "GeneralInfoTab",
				"values": {
					"order": 0
				}
			},
			{
				"operation": "merge",
				"name": "OpportunityTitle",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "Amount",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 3
					}
				}
			},
			{
				"operation": "merge",
				"name": "ResponsibleDepartment",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 3
					}
				}
			},
			{
				"operation": "move",
				"name": "ResponsibleDepartment",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 3
			},
			{
				"operation": "merge",
				"name": "Probability",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "Owner",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 4
					}
				}
			},
			{
				"operation": "merge",
				"name": "Category",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 5
					}
				}
			},
			{
				"operation": "merge",
				"name": "Source",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 5
					}
				}
			},
			{
				"operation": "merge",
				"name": "Type",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 6
					}
				}
			},
			{
				"operation": "move",
				"name": "Type",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 8
			},
			{
				"operation": "merge",
				"name": "CreatedOn",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 6
					}
				}
			},
			{
				"operation": "merge",
				"name": "Partner",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 7
					}
				}
			},
			{
				"operation": "merge",
				"name": "CloseReason",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 7
					}
				}
			},
			{
				"operation": "insert",
				"name": "DATETIME26d46360-17b4-45ee-acac-da084cf0aa67",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 8,
						"layoutName": "OpportunityPageGeneralBlock"
					},
					"bindTo": "UsrTestDateTime",
					"enabled": true
				},
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 12
			},
			{
				"operation": "merge",
				"name": "Description",
				"values": {
					"layout": {
						"colSpan": 23,
						"rowSpan": 1,
						"column": 1,
						"row": 0
					}
				}
			},
			{
				"operation": "insert",
				"name": "UsrSchemaf6483d73Detaile560e0a4",
				"values": {
					"itemType": 2,
					"markerValue": "added-detail"
				},
				"parentName": "GeneralInfoTab",
				"propertyName": "items",
				"index": 5
			},
			{
				"operation": "merge",
				"name": "LeadTab",
				"values": {
					"order": 4
				}
			},
			{
				"operation": "merge",
				"name": "TacticAndCompetitorTab",
				"values": {
					"order": 1
				}
			},
			{
				"operation": "merge",
				"name": "CheckDate",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 2
					}
				}
			},
			{
				"operation": "merge",
				"name": "ProductsTab",
				"values": {
					"order": 2
				}
			},
			{
				"operation": "merge",
				"name": "HistoryTab",
				"values": {
					"order": 5
				}
			},
			{
				"operation": "merge",
				"name": "HistoryAccountTab",
				"values": {
					"order": 6
				}
			},
			{
				"operation": "merge",
				"name": "NotesTab",
				"values": {
					"order": 7
				}
			},
			{
				"operation": "move",
				"name": "IsPrimary",
				"parentName": "OpportunityPageGeneralBlock",
				"propertyName": "items",
				"index": 0
			}
		]/**SCHEMA_DIFF*/
	};
});

As a result when opening the page you will get a custom button with items:

Also forgot to metion that you need to add localizable strings:

 

1) For OpportunityPageV2

 

CustomButtonCaption with "Custom action" value

 

2) For OpportunitySectionV2

 

CustomButtonCaption with "Custom button" value

 

Hope this example help!

 

 

Show all comments

Hello Creatio Community,

I'm experiencing an error while working with Creatio and hope someone might be able to shed some light on this issue.

The error message I'm receiving is:

Has anyone encountered this specific Terrasoft.Common.ValidateException error before? I'd like to understand what might be causing it and how I can resolve it.

Any insights or suggestions would be greatly appreciated. Thank you!

Like 0

Like

1 comments

Hello,

 

Could you please specify how did you reproduce it? 

Show all comments

Hi Community,

 

Any idea what is the destroy OOB function in Section Page. We need to override it for our custom functionality.

Like 0

Like

1 comments

Greetings,



We have an Academy guide which would help you get more acquainted with our Section Page functionality, but please take note that further deletion of any OOB functions may lead to errors in your application:

https:/academy.creatio.com/docs/developer/interface_elements/section/overview#title-2330-13

Show all comments

Hello Community,

 

I have requirement that to provide access of a particular custom lookup to a organizational role who can add, edit, and delete items in the lookup. 

 

Regards,

Jagan

Like 0

Like

2 comments

Hello,

 

Unfortunately, it is not possible to grant permissions to selected users/roles to access particular lookups. At the moment, it is possible to manage permissions only for all users/roles at once.

Bogdan,

I have been able to achieve this with a business process.

Show all comments