Dear colleagues,

 

In a Freedom ListPage, I need to process all the records that a user selects AND REPORT THE RESULTS AT THE END.

 

I'm having trouble figuring out how to approach this task. Currently, as I understand it, we call a process with the ID of the record to be processed.

 

Is there a way to know when all the selected records have been processed and know which ones?

 

I'm trying to implement a temporary table to insert the IDs of the selected records, but for this, I need to have a unique ID in that temporary table so that if there are multiple users doing the same thing, the current user's records are not mixed up. To do this, I've edited the code of the page where the service call is made to pass a second parameter to the process, an ID that I need to generate, but the generated ID is always the same "00000000-0000-0000-0000-000000000000":

			"parameterMappings": {
				"NotaCreditoID": "Id",
				"ProcesoID": Terrasoft.utils.generateGUID()
			},

 

What am I doing wrong with this approach?

 

Here is an excerpt of the modified code:

 

define("NdosNotasCredyDeb_ListPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {

 

"operation": "insert",
"name": "Button_ft2cncy",
"values": {
	"type": "crt.Button",
	"caption": "#ResourceString(Button_ft2cncy_caption)#",
	"color": "default",
	"disabled": false,
	"size": "large",
	"iconPosition": "only-text",
	"visible": true,
	"clicked": {
		"request": "crt.RunBusinessProcessRequest",
		"params": {
			"processName": "NdosLiberaDescartaNC_CC",
			"processRunType": "ForTheSelectedRecords",
			"showNotification": true,
			"dataSourceName": "PDS",
			"parameterMappings": {
				"NotaCreditoID": "Id",
				"ProcesoID": Terrasoft.utils.generateGUID()
			},
			"filters": "$Items | crt.ToCollectionFilters : 'Items' : $DataTable_SelectionState | crt.SkipIfSelectionEmpty : $DataTable_SelectionState",
			"sorting": "$ItemsSorting",
			"selectionStateAttributeName": "DataTable_SelectionState"
		}
	},
	"clickMode": "default"
},

 

On the other hand, has anyone done this in any other way? How?

 

Thank you very much

 

Julio

Like 0

Like

4 comments
Best reply

Hi Julio, 

As of Creatio 8.1.3 you can pass multiple records into a process using a collection parameter. This executes a single process for the collection of selected records. See an example in this article: https://customerfx.com/article/launching-a-process-for-multiple-records-in-a-creatio-list/

Ryan

I'm also tried sdk.generateGuid(), I test it on the console and returns a Guid, but for some reason the parameters is not delivered to the process, what's wrong?

Hi Julio, 

As of Creatio 8.1.3 you can pass multiple records into a process using a collection parameter. This executes a single process for the collection of selected records. See an example in this article: https://customerfx.com/article/launching-a-process-for-multiple-records-in-a-creatio-list/

Ryan

Ryan Farley,

Thanks Ryan,

 

I know and I use them, the problem is the process ran for each record individually and if I need to detect when it processes all selected records, generate a report like "Selected records xxx, processed records yyy" and actually this is not possible 

 

At least I don't know how to do this.

 

Thanks again

 

Julio

Thanks Ryan, your article solves my problem, great job as usual

 

Regards

Julio

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 know where can we change the message and graphics Creatio displays in a list page (Freedom & Classic pages) where no data? and the same in Next Steps?

 

Thanks

Julio

Like 1

Like

5 comments
Best reply

Julio.Falcon_Nodos,

I like to get rid of the graphic and also the "Nothing to show here!" text so I use the following: 

#next-steps-no-data-animation, 
.next-steps-no-data-main-label {
    display: none;
}

This changes it from this: 

To this: 

Ryan

I'd prefer not to have the graphics in these areas. I've been removing them with CSS, I believe that is the only option.

Ryan

Ryan Farley,

Thanks Ryan, which CSS need to modify to list pages and Next steps?

Julio.Falcon_Nodos,

I like to get rid of the graphic and also the "Nothing to show here!" text so I use the following: 

#next-steps-no-data-animation, 
.next-steps-no-data-main-label {
    display: none;
}

This changes it from this: 

To this: 

Ryan

Thanks!, I owe you a beer in Miami! :-)

Ryan Farley,

Dear Ryan, and to ListPages, when there no data? regarding Freedom pages?

Show all comments

Dear community,

Using "useThousandSeparator": false we can remove comma in section edit page or detail edit page. How do we do it in Section list Page?

 

Thanks

Like 0

Like

4 comments

Hello Shivani,

 

You can change the column format in prepareResponseCollectionItem method.

Here is a sample:

define("SomeSection", [], function() {
    return {
        entitySchemaName: "SomeSectionSchema",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
        methods: {
            prepareResponseCollectionItem: function(item) {
                this.callParent(arguments);
               
                var someColumn = item && item.columns && item.columns.SomeColumn;
                if (someColumn) {
                    someColumn.dataValueType = Terrasoft.DataValueType.TEXT;
                    item.set("SomeColumn", item.values.SomeColumn.toString());
                }
            }
        }
    };
});

 

Best regards,

Bogdan S.

Bogdan Spasibov,

That is fantastic Bogdan. Thanks for sharing this!

Ryan

This works for the section - is there a code for a detail on the contact page? I need to remove the comma from the year field here

Hi Heather, 

 

Please refer this post where this question was explained.

 

https://community.creatio.com/questions/special-character

 

The logic for section differs from page and there is no way to apply the property to the grid.

 

Regards,

 

Bogdan L.

Show all comments