Controlling Macro Processes in Freedom ListPages: Processing Multiple Records

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