You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

InvokeAction are not working properly when RegisterAction is having a promise or Fetch

Received Response
31
Views
1
Comments

Summary:

InvokeAction are not working properly when RegisterAction is having a promise or Fetch

I have an analytics extension that invokes a event with parameters, and in a console extension that action is registered.

The console extension with registered action has a Fetch API call with IExtensionPromise that makes an API call and returns the result back to the caller. Now the problem is that the Invoke action is executing next line and not waiting for the Promise to be completed in the Console extension.

Content (please ensure you mask any confidential information):

BUI Analytics Extension Code:

reUsableVars.globalContext.invokeAction('CheckIfApproved', { "payRecordId": callBody.payRecordId, "sessionToken": reUsableVars.agentToken})
.then(function (results) 
{
       if (results) { // This is coming as empty like this {"result": [{}]}, which is not the expected response.
                                    console.log(results);
                                    if(results?.items.length > 0){
                                        alert("The record has already been approved. Please refresh the report!");
 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!