Promise with $resolve or $reject causing client action to not execute
Application Type
Service Studio Version
11.10.19 (Build 41208)

I am using asynchronous JavaScript with the help of Promise on a reactive web app. Without using $resolve(), the client action is able to execute successfully albeit having a messed-up code sequence.

However, when using $resolve() / $reject(), the client action no longer executes. 

*This is a special case as I'm calling the client action from within another, by passing it as a callback function. Furthermore, the Promise mechanism has been verified to work as expected when the client action is called without using the callback*

ShowDialogPrompt is a client action that takes in the JavaScript Callback() function as an object-type input and executes it in its callback.

SubmitAction is a client action that calls a server action, and it returns only a boolean-typed "Result" response.

The use-case of this is to re-use a client action, to display the same prompt dialog in every screen, as required.

Any help would be much appreciated! Thanks in advance :)

As I understand you want to use this code on every screen, then you should move this code in a block and that block should call from every screen where you want to use it.

this can be a workaround for reuse things with web blocks

It would be better if you share a sample OML.

Thanks for your suggestion, Amit. However, I dont think that will work for my current scenario, as the DialogCallbackHandler javascript element will always execute a different client action (i.e. "ClientActionA" - record creation, "ClientActionB" - search function), which performs different tasks.

In addition, this is a legacy project that's passed down to me, and I would want to avoid changing the structure, if possible.

Would you be able to suggest a solution that works around the current implementation instead?

I appreciate your suggestion and help, though!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.