Question

Trouble with crt.SaveRecordRequest

Hi everybody, I have the following task: 

on some form a "Product" field exists. After it's value had changed, I need to fill two subordinate objects (details) on the same page. Logic:

{
	request: "crt.HandleViewModelAttributeChangeRequest",
	handler: async (request, next) => {
	if (request.attributeName === "Product" && !request.silent) {
		const product = await request.$context.Product;
		console.log(typeof product);
		if (typeof product === "object" && !Ext.isEmpty(product)) {
			await FormFunctions.processProductChange(request);
			const saveResult = await this.handlerChain.handlerChain$.process({
				type: "crt.SaveRecordRequest",
				preventCardClose: true,
				$context: request.$context
			});
			debugger;
			if (saveResult) {
				await FormFunctions.fillOrderItemTopics(request);
				await FormFunctions.fillOrderItemStructure(request);
			}
		}
	}
}

unfortunate result:

if the same task is being solved as some handler on some button, no problem occurs. Any suggestions please? 

Like 0

Like

0 comments
Show all comments