Get Changed Fields in SaveRecordRequest Handler

Hi

I am in SaveRecordRequest handler and I need to  get the changed field in page before saving the record, How can I know this?

 

Regards

Rakshith Dheer

Like 0

Like

4 comments

Hello!

As I get from your request - your main goal is to update the data in detail. To do so, you should call the LoadDataRequest for dataSourceName of this detail (or for a separate field of the object):

request: "crt.SaveRecordRequest",
handler: async (request, next) => {
	await next?.handle(request);
	const gridDetailDataSourceName = request.$context.getBoundDataSourceNameByAttributePath("GridDetail_pds6xcv");
	await request.$context.executeRequest({
		type:"crt.LoadDataRequest",
		$context: request.$context,
		"dataSourceName": gridDetailDataSourceName,
		"config": {
			"loadType": "reload",
			"useLastLoadParameters": true
		}
	});
}

 

Hi

Anhelina,

 

The Main Goal is to get the changed fields. For example, we open a record, make some changes to two fields and click on save button. In the SaveRecordRequest we should be able to get the changed fields name and it's value

 

Regards

Rakshith Dheer

 

Is there any solution , how to get the new value of changed data before save in request: "crt.SaveRecordRequest", ???

Safa Ghandri,

 

If you are looking into the direct way to get changed attributes values in the SaveRecordRequest - there is none documented on our side. But you can use HandleViewModelAttributeChangeRequest (will be triggered when anything is changed on the page or you can also add additional filtration to trigger a custom logic upon modification of specific attributes) where request has the oldValue and value properties, save the original values of needed attributes into the separate parameters and use these parameters in your task.

Show all comments