How access all items thas was modified on Freedom UI Page

Anyone knows how to access what was changed in the listview in Freedom?

I know crt.SaveRecordsRequest is the event for saving, but what I want to access is basically the identifier of what will be saved in the updatequery requests. I wanted to include fields depending on what was changed.

*Image below is what SaveRecordsRequest executes

{
	request: "crt.SaveRecordsRequest",
	handler: async (request, next) => {
		return await next.handle(request);
	}
},
Like 0

Like

4 comments

Sounds like it would work to just use a change event hander. Then, whenever one of the fields you're looking for changes, you set the other related ones. See https://customerfx.com/article/responding-to-an-event-when-a-field-is-changed-on-a-creatio-freedom-ui-page/

{
    request: "crt.HandleViewModelAttributeChangeRequest",
    handler: async (request, next) => {
        if (request.attributeName === "MyFieldAttrName" && !request.silent) {
            // use request.value, if field value is needed;
            // set other fields
            request.$context.SomeOtherFieldAttr = "new value";
        }
 
        return next?.handle(request);
    }
}

Ryan

Ryan Farley,

I can't make it work in list view. I tried updating the value of the field as per arrays index in GridDetail_Items but did not reflect. 

Right now, I am doing save and not relying on Save All - SaveRecordsRequest (which i wanna do to avoid multiple xhr calls).

//...HandleViewModelAttributeChangeRequest...
 
const model = await sdk.Model.create("Activity"); 
								await model.update(
									{ 
										StartDate: usrStartDate,
										DueDate: usrDueDate
									},
									[{ 
										type: sdk.ModelParameterType.PrimaryColumnValue, 
										value: selectedId 
									}]
								);

Solem Khn,

I would start with adding the extra fields to the list's data source (assuming they are not in the list layout already)

/**SCHEMA_VIEW_CONFIG_DIFF*/,
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
    {
        "operation": "merge",
        "path": [
            "attributes",
        ],
        "values": {
            "Items": {
                "viewModelConfig": {
                    "attributes": {
                        "PDS_UsrSomeField": {
                            "modelConfig": {
                                "path": "PDS.UsrSomeField"
                            }
                        }
                    }
                }
            }
        }
    }
]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,

As for how to set the value, I am not sure - I've not tried that. However, I believe getting the field in the list's data source would be the first step. Then it's a matter of figuring out how to set the attribute correctly. I would add a change event handler to see what attributes get changed when you edit a column value manually in the list. 

Ryan

Hi Solem Khn,

Unfortunately, for now, it is not possible to track items that were modified on the list page as it is done on the form page. Mainly because one is a single record (form) and the other is a collection of records (list).

However, we have registered this idea for the responsible R&D team to consider and implement in future releases of the application.

Thank you.

Show all comments