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

2 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 
									}]
								);
Show all comments