Hello.

I have a freedom UI FormPage, which may be opened from Business process (Open edit page element). I want to override Cancel button handler in such way that to cancel current business process. I need to know process id (SysProcessLog table) or process element id (SysProcessElementLog table). How could I obtain them in Freedom UI? For example in Classic UI edit page there was dedicated attribute called ProcessData. I looked through request.$context and didn't find anything similar.

 

Creatio version is 8.1.2

Like 0

Like

2 comments

Hello!

 

To find information, you can read the data from SysProcessData, more information which contains the interrelationship between the process instance and the subprocess, the relationship to the process scheme, the relationship to the process scheme element if the instance is a subprocess, and the current status of the process instance. Also, the internal state of the process is a snapshot of the values of the parameters at times when the process elements are executed.

 

Also, this article could be useful:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/development-tools/external-ides/examples/develop-c-sharp-code-in-a-custom-project

 

Kyrylo Atamanenko,

Thanks for an answer. But to read all those information I need to know Id of an element being executed. For example in Classic UI it is obtained like 

this. 

const processElementUId = this.get("ProcessData").procElUId;

And the question is there analogue in Freeom UI page?

Show all comments

Hi there. 

The goal is to adjust visibility of row toolbar Item depending on the value of the field of corresponding record. I added necessary column (ClvSaleStatus) to the list in Freedom UI designer, so all the changes to viewConfigDiff, viewModelConfigDiff and modelConfigDiff look to be present. But nevertheless, If i hide that column manually in the list page then corresponding attribute has undefined value and toolbar item is not visible

viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"name": "DataTable",
		"values": {
			"columns": [
				...
				{
					"id": "791d9bca-eac2-a585-0b1f-8ebacf4e2fa4",
					"code": "PDS_ClvSaleStatus",
					"path": "ClvSaleStatus",
					"caption": "#ResourceString(PDS_ClvSaleStatus)#",
					"dataValueType": 10,
					"referenceSchemaName": "ClvSaleStatus"
				}
			],
			"rowToolbarItems": [
				...
				{
					"type": "crt.MenuItem",
					"caption": "#ResourceString(ReserveObjectMenuItemCaption)#",
					"icon": "open-button-icon",
					"disabled": "$Items.PrimaryModelMode | crt.IsEqual : 'create'",
					"visible": "$Items.PDS_ClvSaleStatus | clv.IsObjectForSaleConverter",
					"clicked": {
						"request": "crt.ClvReserveObjectRequest",
						"params": {
							"itemsAttributeName": "Items",
							"recordId": "$Items.PDS_Id"
						}
					}
				}
			]
		}
	}
...
]/**SCHEMA_VIEW_CONFIG_DIFF*/
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
	...
	{
		"operation": "merge",
		"path": [
			"attributes",
			"Items",
			"viewModelConfig",
			"attributes"
		],
		"values": {
			...
			"PDS_ClvSaleStatus": {
				"modelConfig": {
					"path": "PDS.ClvSaleStatus"
				}
			}
		}
	},
]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/
modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"path": [
			"dataSources",
			"PDS",
			"config"
		],
		"values": {
			"entitySchemaName": "ClvObject",
			"attributes": {
				...
				"ClvSaleStatus": {
					"path": "ClvSaleStatus"
				}
			}
		}
	}
]/**SCHEMA_MODEL_CONFIG_DIFF*/,
converters: /**SCHEMA_CONVERTERS*/{
	"clv.IsObjectForSaleConverter": function(value) {
		const result = value?.value == ClvJsConsts.ClvSaleStatus.ForSale;
		return result;
	}
}/**SCHEMA_CONVERTERS*/,
Like 0

Like

4 comments

Hi, here is an example of how to get the column value:

viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
			{
				"operation": "insert",
				"name": "DataGrid_3c1xo0k",
				"values": {
					----
					"columns": [
						------
						{
							"id": "a68e978a-790d-9af6-974e-c102ee0bd00e",
							"code": "DataGrid_3c1xo0kDS_Stage",
							"path": "Stage",
							"caption": "#ResourceString(DataGrid_3c1xo0kDS_Stage)#",
							"dataValueType": 10,
							"referenceSchemaName": "OpportunityStage"
						}
					],
					"rowToolbarItems": [
						{
							"type": "crt.MenuItem",
							"caption": "Test",
							"icon": "open-button-icon",
							"disabled": false,
							"visible": "$DataGrid_3c1xo0k.DataGrid_3c1xo0kDS_Stage | clv.IsObjectForSaleConverter",
							------
			},
-----
		]/**SCHEMA_VIEW_CONFIG_DIFF*/,
		viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
			{
				"operation": "merge",
				"path": [
					"attributes"
				],
				"values": {
					-----
					"DataGrid_3c1xo0k": {
						"isCollection": true,
						"modelConfig": {
							"path": "DataGrid_3c1xo0kDS"
						},
						"viewModelConfig": {
							"attributes": {
								"DataGrid_3c1xo0kDS_Title": {
									"modelConfig": {
										"path": "DataGrid_3c1xo0kDS.Title"
									}
								},
								"DataGrid_3c1xo0kDS_Stage": {
									"modelConfig": {
										"path": "DataGrid_3c1xo0kDS.Stage"
									}
								},
-----
					}
				}
			}
		]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,
		modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[
			----
		]/**SCHEMA_MODEL_CONFIG_DIFF*/,
		handlers: /**SCHEMA_HANDLERS*/[]/**SCHEMA_HANDLERS*/,
		converters: /**SCHEMA_CONVERTERS*/{
			"clv.IsObjectForSaleConverter": function(value) {
				const result = value?.value == "test";
				return result;
			}
		}

Dmytro Vovchenko,

Well I didn't see any difference to mine code except that you are probably making it for detail and thus inserting new collection attribute "DataGrid_3c1xo0k" while my code is for section and thus merges new attribute to some collection attribute called "Items" which is added in BaseGridSectionTemplate schema.

Anyway, I solved my task by jsut making "clv.IsObjectForSaleConverter" async and requesting column value from db if it's hidden from the list

converters: /**SCHEMA_CONVERTERS*/{
	"clv.IsObjectForSaleConverter": async function(value, scope) {
		let result = value?.value == ClvJsConsts.ClvSaleStatus.ForSale;
		if (!result && !value) {
			const currentRecId = await scope.PDS_Id;
			if(sdk.isGuid(currentRecId)) {
					  const dataModel = await sdk.Model.create("ClvObject");
 
					  const filters = new sdk.FilterGroup();
 
					  filters.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Id", currentRecId);
 
					  const records = await dataModel.load({
						  attributes: ["Id", "ClvSaleStatus"],
						  parameters: [{
							  type: sdk.ModelParameterType.Filter,
							  value: filters
						  }
				]
					  });
					  const firstRecord = records[0];
					  const recSaleStatusId = firstRecord?.ClvSaleStatus?.value;
					  result = recSaleStatusId == ClvJsConsts.ClvSaleStatus.ForSale;
			}
		}
		return result;
	}
}/**SCHEMA_CONVERTERS*/,

 

Dmytro Vovchenko,

Ok, I rewrote viewModelConfigDiff to exactly match yours

{
	"operation": "merge",
	"path": [
		"attributes",
	],
	"values": {
		"Items": {
			"viewModelConfig": {
				"attributes": {
 
					"PDS_ClvSaleStatus": {
						"modelConfig": {
							"path": "PDS.ClvSaleStatus"
						}
					},
 
				}
			}
		}
	}
},

And it didn't help. If I hide column from the list => I get value argument of converter clv.IsObjectForSaleConverter as undefined. 

 

I looked into data saved to profile when hiding column from the list and it appears that it also modifies  viewModelConfigDiff and contains next snippet.

"viewModelConfigDiff": [
 
	{
		"operation":"remove",
		"path":[
			"attributes",
			"Items",
			"viewModelConfig",
			"attributes"
		],
		"properties":[
			"PDS_ClvSaleStatus"
		]
	}
]

 

The main point I experimented with is how to apply a converter in this line:

"visible": "$DataGrid_3c1xo0k.DataGrid_3c1xo0kDS_Stage | clv.IsObjectForSaleConverter"

When it was filled incorrectly, I saw the same problem behavior that you described. The example I provided should tell you how it needs to be filled. Please check this part in your code.

Show all comments

Hi

 

Somebody tried to enable Playbook areticles in a Freedom UI DCM's?

 

I tried, but they didn't appears

 

Some trick?

 

Thanks

Julio Falcón

Like 0

Like

2 comments
Best reply

Ryan Farley,

Thanks Ryan, I saw that it is a new component, I was looking for it in the DCM, as in Classic UI. :-)

Show all comments

Hi, when in a section that contains a multiple cases. you change from one case to another with a field change, a button is shown to validate the case change. 



Is there a way to avoid this? I want to progress bar to automatically update from one case to the other without user intervention. 

Like 1

Like

1 comments

Hi

 

Somebody know how determine, when working with a record in a Freedom UI page if it corresponds to a new record (new/copy)?

 

Thanks in advance

 

Regards

 

Julio Falcón

Like 0

Like

7 comments

Hello Julio,

const cardState = await request.$context.CardState;
if (cardState == "add" || cardState == "copy") {
     // do something here
}

Ryan

Ryan Farley,

Thanks Ryan, where did you find/get this kind of information?

Ryan Farley,

Ryan,

 

In which kind of handler request I must introduce the code? I tried in crt.OpenPageRequest, but nothing happens. The code I'm using:

 

handlers: /**SCHEMA_HANDLERS*/[ // NdosEntity_4ad7b54DS.NdosPeriodicidadMP
	{ 
		request: "crt.OpenPageRequest",
		handler: async (request, next) => {
			const okBtn = {
				key: "OK",
				config: {
					color: "accent",
					caption: "OK"
				}
			};
 
			const cancelBtn = {
				key: "CANCEL",
				config: {
					color: "primary",
					caption: "Salir"
				}
			};
 
			// Nuevo o Copia
			const cardState = await request.$context.CardState;
 
			// Mensaje...
			const result = await request.$context.executeRequest({
				type: "crt.ShowDialogRequest",
				$context: request.$context,
				dialogConfig: {
					data: {
						message: ( cardState == "add" || cardState == "copy" ) ? "New: Este es un nuevo registro" : "Existing one: Este registro ya existe" ,
						actions: [ okBtn, cancelBtn ]
					}
				}
			});
 
			if (result === "OK") {
				// Clica en OK
 
			}
 
			/* Siguiente handler, retorna resultado */
			return next?.handle( request );
 
		},	
	},
]

Julio.Falcon_Nodos,

You would add this in the page you’re opening, not in the code that opens the page. What is the intent you’re trying to produce? I assume that in a page you’re wanting to know if the page is in add mode vs edit. Correct? To accomplish this you’d add something such as a crt.HandleViewModelResumeRequest on the page and check the cardstate there. 

Thanks Ryan, I'm also try using crt.HandleViewModelResumeRequest, but nothnig happens.

 

What I need is that when I open the page "Air Equipment/NdosPage_3ud8c3e" it can detect if I am working with a new record and do something. So it is in the code of this page, where I enter the commented code, compile, open an existing record and create a new one and the code entered does not execute/does not work in any situation.

 

If I add the code inside a crt.HandleViewModelAttributeChangeRequest, it works, but it stays 

in loop and to exit I have to go back in the browser.

 

I made a short video to show what I'm doing and where the code is in case it helps to understand, see at

https://share.vidyard.com/watch/NRBjhx3hjzCi9sZ2x5qsSK?

 

In Classic UI I've the onEntityInitialized method to execute when open the page, but in Freedom is very different

 

Thanks again

Julñio

Julio.Falcon_Nodos,

Hello Julio,

Does it also not enter the handler if you try adding a "crt.HandleViewModelInitRequest"?

Ryan Farley,

No Ryan, I didn't understand what's wrong with my code :-(, 

 

Show all comments

I am looking for assistance with a challenge I am facing in the Freedom UI of Creatio regarding the display of decimal field values in a label.

The issue I am encountering is that when I try to display a decimal value in a label on the Freedom UI page, the value is not being comma-separated as expected. For example, if the decimal value is 23,586.06, the label only shows 23586.06 without the comma. Similarly, for the value 1,000.00, the label displays only 1000 instead of 1,000.00.

What I am aiming for is to have the decimal values displayed with commas for better readability. For instance, the value 23,586.06 should be displayed as 23.586.06, and 1,000.00 should appear as 1,000.00 in the label on the Freedom UI page.

I have tried several approaches to address this issue within the Freedom UI but have not been successful in achieving the desired result.

Like 0

Like

4 comments

Hello Satyam,

 

Could you please clarify how exactly you implemented the 'decimal number' in the label?

When you set the number in the attribute bound to the label you can use toLocaleString:

request.$context.MyAttribute = num.toLocaleString();

Ryan

.

Hello ,

 

Thanks for the response.
 

The below given code is how we are currently setting the value of the UsrAmount decimal field to be shown as a label caption.

{
                "operation": "insert",
                "name": "Label_td5mlo3",
                "values": {
                    "layoutConfig": {
                        "column": 1,
                        "row": 2,
                        "colSpan": 1,
                        "rowSpan": 1
                    },
                    "type": "crt.Label",
                    "caption": "$PDS_UsrAmount_7hu2ut1",
                    "labelType": "headline-1",
                    "labelThickness": "bold",
                    "labelEllipsis": false,
                    "labelColor": "#181818",
                    "labelBackgroundColor": "transparent",
                    "labelTextAlign": "center",
                    "visible": true
                },
                "parentName": "GridContainer_rpq3gxq",
                "propertyName": "items",
                "index": 1
            }

 

As a result, it picks the value from the decimal field and shows in the label as shown in the screenshot below:

 

I want to show the Label caption in the same format as that of the amount field. Also another thing that we have noticed is that when the amount is 1,000.00 , the caption shows 1000 instead of 1000.00. 

kindly help

Show all comments

Hi Community,

 

We have this business requirement where we need to add duplicated communication options. For example, we can have two records for the same phone number.

 

When we try to add the same number, we receive the following error:

 

How can we turn off this validation/constraint? 

 

Thank you in advance.

Best Regards,

Pedro Pinheiro

Like 0

Like

2 comments

Hello Pedro,

You can add a few equal phone numbers as the communication options. All you need is to choose the different types for them:

Hi Anhelina,

 

Thank you for the response.

 

The idea here is to use the same type. For example, we need to create multiple duplicated instances for "Mobile Phone", because later on we will be using these records for our business logic. The number might be the same, but we have other attributes that have unique keys. We want to change this rule so it can be applied to those attributes.

 

Best Regards,

Pedro Pinheiro

Show all comments

Hi 

I am trying to use the crt.UploadFileRequest in the action menu on the click of 'Upload a file' as shown in the figure. But the functionality doesn't work as the upload function in the attachment detail. Is there any other we can use upload a file from clicking button in the action-menu. 

Like 0

Like

4 comments

Hello,

 

Please describe in detail how this detail was implemented so we could better understand the issue.

Mira Dmitruk,

 

We are basically trying to add the Upload File  funtionality to the Menu item (Upload File as shown above in the image). 

 

We created a attachment detail through the desinger page and gave the functionality shown in the image  (which is the upload functionality for upload button for the attachement detail ) below to the rowToolbarItems (menu item). But it dosen't work 

Hello,
It looks like the best possible option is to use the Button with the "Upload file" action. Also, each detail has an option "Data import" with the following code, perhaps it can be helpful in your task.

                    "clicked": {
                        "request": "crt.ImportDataRequest",
                        "params": {
                            "entitySchemaName": "ServiceEngineer"
                        }
                    },

This is what I am using to upload files in Freedom UI:

const handlerChain = sdk.HandlerChainService.instance;
await handlerChain.process({
	type: "crt.UploadFileRequest",
	$context: request.$context,
	fileEntitySchemaName: "AccountFile",
	recordColumnName: "Account",
	recordId: accountId
});

Note that if you're not using the viewElementName property the list won't refresh on it's own (however, you can refresh separately, if needed)

Ryan

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 

 

Can we add a button in a column for a  detail in Freedom UI. The Button should be in  place of the data in the column for each record.

Like 0

Like

1 comments
Best reply

It doesn't allow adding buttons in the list columns, as far as I am aware. However, you can add to the row actions menu (the three dot button menu on the left side of the list). See https://customerfx.com/article/adding-row-action-menu-items-to-a-creatio-freedom-ui-list/

Ryan

It doesn't allow adding buttons in the list columns, as far as I am aware. However, you can add to the row actions menu (the three dot button menu on the left side of the list). See https://customerfx.com/article/adding-row-action-menu-items-to-a-creatio-freedom-ui-list/

Ryan

Show all comments