Pop up message on record opening then issue opening other records

Hi all,

I have a customer need when opening a case the user has to choose which is the next status for going on.

I followed this article: https://customerfx.com/article/opening-a-record-for-edit-in-a-specific-…

 

I implemented successfuly on case record opening the popup for choosing the next status when status is new or reopened, .... 

 

It is working fine for opening first record but when closing the record and opening an other record then having an issue on opening the record the variable are not set. 

 

When doing a full refresh in the browser then the record is opening correctly. Do I need to invoke any destroy method after the popup ?

Here is the code of the handler:

          {
          request: "crt.HandleViewModelResumeRequest",
            handler: async (request, next) => {
              const handlerChain = sdk.HandlerChainService.instance;
              const recId = await request.$context.Id;
              const statusStr = await request.$context.PDS_Status_47jug57;
              
              const dspStatus = statusStr.displayValue;
                
                if(dspStatus=="New" || dspStatus=="Reopened"||dspStatus=="In progress" || dspStatus=="Waiting for response"){
                 await handlerChain.process({
                      type: "crt.OpenPageRequest",
                      $context: request.$context,
                      scopes: [...request.scopes],
                      schemaName: "s4aCaseStatus_ModalPage",
                        modelInitConfigs: [
                            {
                                action: "edit",
                                recordId: recId
                            }
                        ]
                    }
              );
             }
              
              return next?.handle(request);
            }
           }

 

Thanks in advance

Like 1

Like

2 comments

There are currently issues with reading/setting values in the HandleViewModelResumeRequest. For a workaround, try wrapping things in a setTimeout to delay it slightly. 

setTimeout(async () => {
	// do stuff here
	const statusStr = await request.$context.PDS_Status_47jug57;
	// etc
}, 300);

Hopefully we see this fixed/changed soon, it's a horrible hack :) See more here: https://community.creatio.com/questions/813-or-812-breaks-page-param-se…

Ryan

Thanks Ryan the fix workied. Hoping this bug is getting corrected soon.

Show all comments