await next.handle(request) in SaveRecordRequest return undefined

Hi Community,

I want to run a function only if the SaveRecordRequest is true. I tried to run await next.handle(request), but it returns undefined even if the record is save is successfully. Here is my code and test result:

 

 

			{
				request: "crt.SaveRecordRequest",
				handler: async (request, next) => {
					const saveResult = await next.handle(request);
					if(saveResult) {
						const id = await request.$context.Id;
						const files = await request.$context.SPJFile;
						await carPooling.uploadSPJ(id, files);
						request.$context.SPJFile = null;
					}
 
					return saveResult;
				}
			},
Like 0

Like

1 comments
Show all comments