Hello creatio community,

 

I have created a column into the object "RegDocumentType" named "Order". This object is used as a foreign key in "DocListInFinApp" which is displayed in "FinAppLendingPage" screen.

 

I want to apply a default sorting by RegDocumentType.Order in FinAppLendingPage as below:

"DocListInFinAppDetail": {
	"schemaName": "DocListInFinAppDetail",
	"filter": {
		"masterColumn": "Id",
		"detailColumn": "FinApplication"
	},
	"sortColumn": "Document",
	"sortColumnDirection": Terrasoft.OrderDirection.ASC,
	"sortColumnIndex": 0
},

 

The filter applied its working when I open the page. Do you have any suggestions on how to fix it?

Like 0

Like

0 comments
Show all comments

Hi team,



I created a multi select lookup page for a detail in freedomUI using "crt.OpenLookupPageRequest" functionality. I wanted to either remove already selected records in the popup window or show them as checked if they are added into the detail. 

Source for multiselect page : https://customerfx.com/article/invoking-a-multi-select-lookup-dialog-on-a-creatio-freedom-ui-page/

Can anyone help me with this issue?



Expected functionality:





Thanks in advance

Goparna Nasina

Like 1

Like

1 comments

Hello!

You can use the filtersConfig parameter to filter records, as mentioned in the article.

Or you can use the option selectionState to predefine selected rows, which will be pre-selected when the lookup page is opened.

 

Example of selected records:

{
	type: "crt.OpenLookupPageRequest",
	...
	selectionState: {
		type: 'specific',
		selected: [
			'00000000-0000-0000-0000-000000000000',
			'11111111-1111-1111-1111-111111111111',
		]
	}
}

 

An example of pre-filtering records:

{
	type: "crt.OpenLookupPageRequest",
	...
	filtersConfig: {
		filterAttributes: [
			{
				name: 'MyFilter',
				loadOnChange: false
			}
		],
		attributesConfig: {
			MyFilter: {
				value: {
					"items": {
						"29e16d42-36f1-4e04-9029-4321cbb2494d": {
							"filterType": 1,
							"comparisonType": 11,
							"isEnabled": true,
							"trimDateTimeParameterToDate": false,
							"leftExpression": {
								"expressionType": 0,
								"columnPath": "Name"
							},
							"isAggregative": false,
							"dataValueType": 1,
							"rightExpression": {
								"expressionType": 2,
								"parameter": {
									"dataValueType": 1,
									"value": "Super"
								}
							}
						}
					},
					"logicalOperation": 0,
					"isEnabled": true,
					"filterType": 6,
					"rootSchemaName": "Contact"
				}
			}
		}
	}
}

 

Show all comments

You may encounter an issue when converting a detail into a section, where the pages do not change as expected. In the wizard, it appears as if it's a section, but the actual page that opens is the details page.

The issue was caused by the feature of the architecture of interaction of schemes in the application. The object will be able to contain one Edit page or more if the page type is enabled (different pages are designed for different use cases based on the information that is filled in while creating a record). The current configuration only permits the addition of one page to both a section and a detail of an object. The described situation arose because the detail page was created before the added section. As a result of creating a section, two pages were added for the object in the system tables.

Upon opening the wizard, the system returns the first random page from the select query. This is why you may not see the correct page in the wizard.



For the solution, I recommend saving one page for the detail and for the section.

 

To achieve this, you should delete the record from the system tables and then re-save the edit page:

1) Find all edit pages for the problem object using this script:

select * from "SysModuleEdit"
where "SysModuleEntityId" in (
select "Id" from "SysModuleEntity"
where "SysEntitySchemaUId" in (
select "UId" from "SysSchema"
where "Name" = 'objec_code'));

2) Find and delete the detail edit page:

delete from "SysModuleEdit" where "Id" = 'id_detail_schema';

Before deleting, make sure to save the value from the 'SysEntitySchemaUId' column.

 

3) Delete the record in the table that connects the edit page and detail itself:

delete from "SysModuleEntity" where "Id" = 'id_SysEntitySchemaUId_step_2';

4)  Re-save the edit page using the section wizard.

 

As a result, you will be left with one edit page for detail and section.

Like 0

Like

Share

0 comments
Show all comments

Hello.



I tried loading a detail in a modal, but it is not firing any detail method.

Is it not possible to implement such?



I know lookuputilities exist, but it shows a list as a expanded lookup.

We are more trying to show a detail in modal.



Let me know any updates.

Like 0

Like

1 comments

Hello!



Could you please provide more details regarding your request and step-by-step instructions to reproduce the issue?

Show all comments

Hello,

 

I want to prevent users from deleting details once the status is not DRAFT anymore.

So, I'm thinking to remove the all of the buttons.

Does anyone know how to do this?

 

Thank you.

Like 1

Like

2 comments

Dear David,

 

This can be achieved by code implementation or by business rule.

 

For the business rule, you can turn on Object permissions for this object. Then the business process will be triggered by changing the record for example, and it will be removing right for editing and deleting this record.

 

Hope this helps.

 

Have a great day!

Dear Alina,

 

I notice about this method. 

Actually, I want to keep this method as a last resort.

 

Thank you for your reply.

 

Show all comments

Hi community,

 

I have this requirement where the client must be able to move one or more records from one detail to another through a business process. Following the steps shown in the image below:

 

1. The user must select one or more records from the "Product on Invoice" detail.

 

2. Next, the user executes the business process using the "Add" button. The process must receive the ids of the selected records.

 

3. Finally, all the selected records should then be added to the "Products in the Correction Invoice".

 

 

How can I achieve this requirement on the new Freedom UI?

 

If you need more information, feel free to ask.

 

Thanks in advance.

 

Best Regards,

Pedro Pinheiro

 

 

Like 2

Like

1 comments

Dear Pedro,

 

To execute this idea, you can do the following:

 

1) You can add the element that depends on user's choice in the "User's Action":

 

 

You can add an "Auto-generated/Pre-configured page" asking the user for an Id for example.

 

2) To achieve this, you can add the action on the button to start the business process in the page designer:

 

 

 

For the transfer, you can read the data from both objects, then use the modify data element.

 

You can read more about business process capabilities in the following article tree: https://academy.creatio.com/docs/8.x/no-code-customization/category/bus…

 

Have a great day!

Show all comments

Hi community, 



I have created a detail and now I wanted to convert the detail into an editable list. The option that is provided in the detail setup is disabled. Then I added the required code in the client module. The detail has been converted to editable list but when I click on the record it is throwing the following error. 

The details regarding the issue are attached below.

Could you let me know how can I convert an already existing detail to an editable one?





Thanks in advance

Goparna Nasina.

Like 0

Like

1 comments

Hello,

 

Could you please provide the code you added and specify where exactly it was added?

 

Best regards,

Yuliya

Show all comments

Hey Community,



I'm stuck with problem trying to apply detail business rule on my edit grid. So the problem that business rule is looking to UsrParent.UsrStatus column. And i have the error that this column was deleted or renamed.

I've tried some solutions on Community but nothing is working for me. 

Here is my code:

		methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue) {
				this.mixins.ConfigurationGridUtilitiesV2.onActiveRowAction.call(this, buttonTag, primaryColumnValue);
			},
 
			generateActiveRowControlsConfig: function(id, columnsConfig, rowConfig) {
				//var gridDataColumns = getGridDataColumns();
				this.columnsConfig = columnsConfig;
				var gridLayoutItems = [];
				var currentColumnIndex = 0;
				this.Terrasoft.each(columnsConfig, function(columnConfig) {
					var cellConfig = this.getActiveRowCellConfig(columnConfig, currentColumnIndex);
       			 if (!cellConfig.hasOwnProperty("isNotFound")) {
            		gridLayoutItems.push(cellConfig);
        		}
					currentColumnIndex += cellConfig.layout.colSpan;
				}, this);
				this.applyBusinessRulesForActiveRow(id, gridLayoutItems);
				var viewGenerator = this.Ext.create(this.getRowViewGeneratorClassName());
				viewGenerator.viewModelClass = this;
				var gridLayoutConfig = viewGenerator.generateGridLayout({
					name: this.name,
					items: gridLayoutItems
				});
				rowConfig.push(gridLayoutConfig);
			},
 
				getGridDataColumns: function() {
                var baseGridDataColumns = this.callParent(arguments);
                var gridDataColumns = {
                    "UsrParent.UsrStatus": {path: "UsrParent.UsrStatus"},
                };
                return Ext.apply(baseGridDataColumns, gridDataColumns);
            }
 
},





thanks!

 

Like 0

Like

5 comments

Hi,

 

Do you add this business rule to the grid schema or to the detail edit page schema? Business rules added to the edit page should work properly without this error.

 

Alternatively try this approach with lookupListConfig in either grid schema and edit page schema of the detail (added to the schema attributes):

"UsrParent": {
                    "dataValueType": this.Terrasoft.DataValueType.LOOKUP,
                    "lookupListConfig": {
                        "columns": ["UsrStatus"]
                    }
                },

this should also get the value (and load itself) of the UsrStatus column.

Oleg Drobina,

Hi!



Thanks for ur answer, i already tried this one added in schema detail/page and still the same issue.

Also copied business-rules from page to detail schema.



Here is full code for Detail schema 

define("RdtSchema670160a3Detail", ["ConfigurationGrid", "ConfigurationGridGenerator",
	"ConfigurationGridUtilitiesV2"], function() {
	return {
		entitySchemaName: "RdtProductionRawProducts",
		attributes: {
			"IsEditable": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
				value: true
			},
 
 
			"RdtProduction": {
                    "dataValueType": this.Terrasoft.DataValueType.LOOKUP,
                    "lookupListConfig": {
                        "columns": ["RdtStatus"]
                    }
                }
		},
		mixins: {
			ConfigurationGridUtilitiesV2: "Terrasoft.ConfigurationGridUtilitiesV2"
		},
		businessRules: /**SCHEMA_BUSINESS_RULES*/{
			"RdtRawProduct": {
				"a51ae6d8-b23d-4245-a06f-6f81a6a20f0d": {
					"uId": "a51ae6d8-b23d-4245-a06f-6f81a6a20f0d",
					"enabled": true,
					"removed": false,
					"ruleType": 1,
					"baseAttributePatch": "RdtType",
					"comparisonType": 3,
					"autoClean": false,
					"autocomplete": false,
					"type": 0,
					"value": "0e937c72-3826-40c0-ac62-30d70746cea0",
					"dataValueType": 10
				},
				"7864a234-ef49-4a9c-ac19-9967fb5b255a": {
					"uId": "7864a234-ef49-4a9c-ac19-9967fb5b255a",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtQuantity": {
				"00b698f4-7e53-4a6b-804f-3a2f40e7b015": {
					"uId": "00b698f4-7e53-4a6b-804f-3a2f40e7b015",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtUnit": {
				"825f4f2a-f110-4554-9a83-575440727c00": {
					"uId": "825f4f2a-f110-4554-9a83-575440727c00",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtAvailableStock": {
				"843f04c6-f4c7-426c-85f3-5560b2383db5": {
					"uId": "843f04c6-f4c7-426c-85f3-5560b2383db5",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 1,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtAvailableStock"
							}
						}
					]
				}
			},
			"RdtNotEnoughStock": {
				"7dccf940-c42c-4b5d-82ab-acff711c7893": {
					"uId": "7dccf940-c42c-4b5d-82ab-acff711c7893",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 1,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction"
							}
						}
					]
				}
			}
		}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue) {
				this.mixins.ConfigurationGridUtilitiesV2.onActiveRowAction.call(this, buttonTag, primaryColumnValue);
			},
 
			generateActiveRowControlsConfig: function(id, columnsConfig, rowConfig) {
				this.columnsConfig = columnsConfig;
				var gridLayoutItems = [];
				var currentColumnIndex = 0;
				this.Terrasoft.each(columnsConfig, function(columnConfig) {
					var cellConfig = this.getActiveRowCellConfig(columnConfig, currentColumnIndex);
       			 if (!cellConfig.hasOwnProperty("isNotFound")) {
            		gridLayoutItems.push(cellConfig);
        		}
					currentColumnIndex += cellConfig.layout.colSpan;
				}, this);
				this.applyBusinessRulesForActiveRow(id, gridLayoutItems);
				var viewGenerator = this.Ext.create(this.getRowViewGeneratorClassName());
				viewGenerator.viewModelClass = this;
				var gridLayoutConfig = viewGenerator.generateGridLayout({
					name: this.name,
					items: gridLayoutItems
				});
				rowConfig.push(gridLayoutConfig);
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "DataGrid",
				"values": {
					"className": "Terrasoft.ConfigurationGrid",
					"generator": "ConfigurationGridGenerator.generatePartial",
					"generateControlsConfig": {"bindTo": "generateActiveRowControlsConfig"},
					"changeRow": {"bindTo": "changeRow"},
					"unSelectRow": {"bindTo": "unSelectRow"},
					"onGridClick": {"bindTo": "onGridClick"},
					"activeRowActions": [
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "save",
							"markerValue": "save",
							"imageConfig": {"bindTo": "Resources.Images.SaveIcon"}
						},
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "cancel",
							"markerValue": "cancel",
							"imageConfig": {"bindTo": "Resources.Images.CancelIcon"}
						},
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "card",
							"markerValue": "card",
							"imageConfig": {"bindTo": "Resources.Images.CardIcon"}
						},
						{
							"className": "Terrasoft.Button",
							"style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "copy",
							"markerValue": "copy",
							"imageConfig": {"bindTo": "Resources.Images.CopyIcon"}
						},
						{
							"className": "Terrasoft.Button",
							"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
							"tag": "remove",
							"markerValue": "remove",
							"imageConfig": {"bindTo": "Resources.Images.RemoveIcon"}
						}
					],
					"initActiveRowKeyMap": {"bindTo": "initActiveRowKeyMap"},
					"activeRowAction": {"bindTo": "onActiveRowAction"},
					"multiSelect": {"bindTo": "MultiSelect"}
				}
			}
		]/**SCHEMA_DIFF*/
	};
});

Maybe u have other ideas? 



Much thanks!

Oleksii

Oleksii Protsiuk,

 

Ok, and can you please point me to the business rule from your code that references the UsrParent.UsrStatus column (or is it RdtStatus in the code above)? And also please share the edit page code.

Oleg Drobina,

1. Business rule for RdtQuantity for example.

2. Yes, its RdtStatus.



3. 

define("RdtSchemafaf34ef3Page", [], function() {
	return {
		entitySchemaName: "RdtProductionRawProducts",
		attributes: {
					"RdtProduction": {
                    "dataValueType": this.Terrasoft.DataValueType.LOOKUP,
                    "lookupListConfig": {
                        "columns": ["RdtStatus"]
                    }
                }
		},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{
			"RdtRawProduct": {
				"a51ae6d8-b23d-4245-a06f-6f81a6a20f0d": {
					"uId": "a51ae6d8-b23d-4245-a06f-6f81a6a20f0d",
					"enabled": true,
					"removed": false,
					"ruleType": 1,
					"baseAttributePatch": "RdtType",
					"comparisonType": 3,
					"autoClean": false,
					"autocomplete": false,
					"type": 0,
					"value": "0e937c72-3826-40c0-ac62-30d70746cea0",
					"dataValueType": 10
				},
				"7864a234-ef49-4a9c-ac19-9967fb5b255a": {
					"uId": "7864a234-ef49-4a9c-ac19-9967fb5b255a",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtQuantity": {
				"00b698f4-7e53-4a6b-804f-3a2f40e7b015": {
					"uId": "00b698f4-7e53-4a6b-804f-3a2f40e7b015",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtUnit": {
				"825f4f2a-f110-4554-9a83-575440727c00": {
					"uId": "825f4f2a-f110-4554-9a83-575440727c00",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 3,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction",
								"attributePath": "RdtStatus"
							},
							"rightExpression": {
								"type": 0,
								"value": "22c74599-4c04-401e-8dfd-06fde8f8cb81",
								"dataValueType": 10
							}
						}
					]
				}
			},
			"RdtAvailableStock": {
				"843f04c6-f4c7-426c-85f3-5560b2383db5": {
					"uId": "843f04c6-f4c7-426c-85f3-5560b2383db5",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 1,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtAvailableStock"
							}
						}
					]
				}
			},
			"RdtNotEnoughStock": {
				"7dccf940-c42c-4b5d-82ab-acff711c7893": {
					"uId": "7dccf940-c42c-4b5d-82ab-acff711c7893",
					"enabled": true,
					"removed": false,
					"ruleType": 0,
					"property": 1,
					"logical": 0,
					"conditions": [
						{
							"comparisonType": 1,
							"leftExpression": {
								"type": 1,
								"attribute": "RdtProduction"
							}
						}
					]
				}
			}
		}/**SCHEMA_BUSINESS_RULES*/,
		methods: {},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "LOOKUPa8ab8309-ec3e-4f7b-b007-af2483101fee",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 0,
						"layoutName": "Header"
					},
					"bindTo": "RdtRawProduct",
					"enabled": false,
					"contentType": 5
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 0
			},
			{
				"operation": "insert",
				"name": "LOOKUPe030f444-90d1-4d98-b476-b4b576c4f122",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 0,
						"layoutName": "Header"
					},
					"bindTo": "RdtUnit",
					"enabled": false,
					"contentType": 5
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 1
			},
			{
				"operation": "insert",
				"name": "FLOAT07d52071-3119-4f71-a45f-3e8701a3e127",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 1,
						"layoutName": "Header"
					},
					"bindTo": "RdtQuantity",
					"enabled": false
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 2
			},
			{
				"operation": "insert",
				"name": "RdtAvailableStockbd49a463-5f7d-4a67-aaa6-f01f7cca4cd9",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 12,
						"row": 1,
						"layoutName": "Header"
					},
					"bindTo": "RdtAvailableStock",
					"enabled": false
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 3
			},
			{
				"operation": "insert",
				"name": "RdtNotEnoughStockb7a3c879-7054-4bf6-8434-adb226c77730",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 2,
						"layoutName": "Header"
					},
					"bindTo": "RdtNotEnoughStock",
					"enabled": false
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 4
			}
		]/**SCHEMA_DIFF*/
	};
});



 

The same problem with setting the value of the field using connected entity column on the different detail.

1. The field value is showing on field

2. After save the same error and the field is empty.





Is there any chance to fix this error ?



Thanks!

Show all comments

Hey Community,

 

I have two details on my custom "Order" entity. Depends on order status i need to show/hide add button and the possibility to edit this details.

Is there any best practices for this scenario?



Thanks for help,

Oleksiis

Like 1

Like

6 comments
Best reply

Hello, 

Here is an example of how to hide the Add button in detail based on the condition:

define("UsrSchemaaae5d57eDetail", ["ConfigurationGrid", "ConfigurationGridGenerator",
	"ConfigurationGridUtilitiesV2"], function() {
	return {
		entitySchemaName: "UsrForHideTest",
		attributes: {
                -------------
			"IsAddEnabled": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: true
			}
		},
                -------------
		methods: {
                --------------
			init: function() {
				this.callParent(arguments);
				this.isAddEnabled();
			},
			isAddEnabled: function() {
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                        rootSchemaName: "Contact"
                    });
                    esq.addColumn("Type");
                     esq.getEntity(this.values.MasterRecordId, function(result) {
                        if (result.success && result.entity.values.Type.displayValue == 'Customer') {
                            this.set("IsAddEnabled", false);
                        }
                    }, this);
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "AddRecordButton",
				"values": {
					"visible": {"bindTo": "IsAddEnabled"}
				}
			},

Here we are hiding the button if the Type of the Contact = 'Customer'.

Regarding the editing of the detail, if I`m not mistaken, you cannot change it dynamically. 

Upd

I found the code snippet to hide Add button and added it to page - 

 

			isDetailEnabled: function(detailName) {
      		var productionStage = this.get("RdtStatus").displayValue;   
			if (detailName === "RdtSchemad16d4a3eDetail") {
			if(productionStage === "Planned"){
                    return true;       //Disable the "+" button
                }
                else{
                    return false;        //Enable the "+" button
                }
	}
			if (detailName === "RdtSchema670160a3Detail") {
			if(productionStage === "Planned"){
                    return true;       //Disable the "+" button
                }
                else{
                    return false;        //Enable the "+" button
                }
	}
			return this.callParent(arguments);
}

But now i have issue with clicking on data on editable grid



Hello,

not sure about best practices but for me isDetailEnabled also caused issues like that. I implemented this logic with replacing method in Detail code like this:

getAddRecordButtonEnabled: function() {
				var instance = this;
				var isEditable = instance.get("IsProductDetailEditable");
				return isEditable && this._isAddRecordButtonEnabled();
			},

adding attribute IsProductDetailEditable and settiging its value in onGridDataLoaded method override with an esq check of the parent page Status or any other condition you would need. This would cover add button, for the changes of existing rows you could add buisness rules for each field to block them for certain conditions, in my case implemented an esq check on save logic, with replacing method saveRowChanges from ConfigurationGridUtilities, check result would notify the user unability to save changes for that condition or proceed as normal.

Hello, 

Here is an example of how to hide the Add button in detail based on the condition:

define("UsrSchemaaae5d57eDetail", ["ConfigurationGrid", "ConfigurationGridGenerator",
	"ConfigurationGridUtilitiesV2"], function() {
	return {
		entitySchemaName: "UsrForHideTest",
		attributes: {
                -------------
			"IsAddEnabled": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: true
			}
		},
                -------------
		methods: {
                --------------
			init: function() {
				this.callParent(arguments);
				this.isAddEnabled();
			},
			isAddEnabled: function() {
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                        rootSchemaName: "Contact"
                    });
                    esq.addColumn("Type");
                     esq.getEntity(this.values.MasterRecordId, function(result) {
                        if (result.success && result.entity.values.Type.displayValue == 'Customer') {
                            this.set("IsAddEnabled", false);
                        }
                    }, this);
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "AddRecordButton",
				"values": {
					"visible": {"bindTo": "IsAddEnabled"}
				}
			},

Here we are hiding the button if the Type of the Contact = 'Customer'.

Regarding the editing of the detail, if I`m not mistaken, you cannot change it dynamically. 

Dmytro Vovchenko writes:

Hello, 

Here is an example of how to hide the Add button in detail based on the condition:


 
define("UsrSchemaaae5d57eDetail", ["ConfigurationGrid", "ConfigurationGridGenerator",
	"ConfigurationGridUtilitiesV2"], function() {
	return {
		entitySchemaName: "UsrForHideTest",
		attributes: {
                -------------
			"IsAddEnabled": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: true
			}
		},
                -------------
		methods: {
                --------------
			init: function() {
				this.callParent(arguments);
				this.isAddEnabled();
			},
			isAddEnabled: function() {
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
                        rootSchemaName: "Contact"
                    });
                    esq.addColumn("Type");
                     esq.getEntity(this.values.MasterRecordId, function(result) {
                        if (result.success && result.entity.values.Type.displayValue == 'Customer') {
                            this.set("IsAddEnabled", false);
                        }
                    }, this);
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "AddRecordButton",
				"values": {
					"visible": {"bindTo": "IsAddEnabled"}
				}
			},

Here we are hiding the button if the Type of the Contact = 'Customer'.

Regarding the editing of the detail, if I`m not mistaken, you cannot change it dynamically. 

 

Thanks so much, will take a look on this.

Dmytro Vovchenko,

I tried your code-snippet for this implementation and seems the code not running with editable details. And code triggered only when opening the edit page of detail. 

So on the main page where details exists the Add button still visible :(

Show all comments

Hi, everybody!

 

Given:

There is a detail with an editable grid

It is necessary to apply some filter to the records of the part reference field, but only if there are no records in another part (OrderProduct object) (for a specific Order)

Solution attempt:

An attribute with lookup List Config has been added to the details page:

<br />
      "PrbProduct": {<br />
        "dataValueType": Terrasoft.DataValueType.LOOKUP,<br />
        "lookupListConfig": {<br />
          "filters": [<br />
            function() {<br />
              var subFilterGroup = this.Terrasoft.createFilterGroup();<br />
              subFilterGroup.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "Order", this.$PrbOrder.value));<br />
              var filterGroup = this.Terrasoft.createFilterGroup();<br />
              filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.OR;<br />
              filterGroup.addItem(this.Terrasoft.createNotExistsFilter("[OrderProduct].Id", subFilterGroup));<br />
              filterGroup.addItem(this.Terrasoft.createColumnFilterWithParameter("PrbOrder", this.$PrbOrder.value));<br />
              return filterGroup;<br />
            }<br />
          ]<br />
        }<br />
      },<br />

 

Problem:

It is not possible to find the correct path to the column in create Not Exists Filter. Or there is an error like "Column on the path [Order Product].Id was not found in the "Product" schema, or (with some other values) the filter does not work as needed.

Tell me, please, is it even possible to create Not Exists Filter/createExistsFilter without binding to the detail object?

How to correctly specify the "path to the column" in this case?

Like 0

Like

4 comments
Best reply

Fariz Mamedov,

 

Just open the console in browser (F12 in Chrome) and go to the "Network" tab. And then find the correspondent SelectQuery request and review its body:

Hello Fariz,

 

The task is to create a filter starting from the object of the lookup column for which we are creating the lookupListConfig. The easiest way to properly build path to the needed column is creating the same filter, but using advanced filters in the section. This will result in the SelectQuery request where filters can be reviewed and the content of the filter copied which will show you an accurate path to the column needed.

Oleg Drobina,

Thank you! Interesting trick.

Please, provide details about: "This will result in the SelectQuery request where filters can be reviewed" - how exactly I can review such a request? 

Fariz Mamedov,

 

Just open the console in browser (F12 in Chrome) and go to the "Network" tab. And then find the correspondent SelectQuery request and review its body:

Oleg Drobina, Super thx!

Show all comments