Workspace Client Script - CustomEvent.fireAll - Openframe messaging ( Endless Loop )

Charles Avila
Tera Expert

I am using this workspace client script to present a g_modal dialog to send an SMS message to an Openframe integrated application.  It seems that the 'CustomEvent.fireAll' execution is causing an endless loop in the messaging.


This command certainly sends a message to Openframe but it executes endlessly until the entire browser window refreshes.  What am I missing?  Is there an alternative to sending a message to Openframe from this UI Action script (below) ?

 

UI Action Script (incident Table)

-------

function onClick(g_form) {
    alert('Send Text');
    var userToText = g_form.getReference('caller_id', doText)    function doText(userToText) {        var fields = [
            {
                type:'string',
                name:'mobile_phone',
                label: 'Caller Mobile Phone',
                value: userToText.mobile_phone,
                displayValue: userToText.mobile_phone,
                readonly: true
            },
            {
                type: 'textarea',
                name: 'messageBody',
                label: 'Message Content',
                mandatory: true
            }
        ];
        g_modal.showFields({
            title: "Send Text Message",
            fields: fields,
            // buttons: buttons,
            confirmTitle: "Send",
            cancelTitle: "Cancel",
            size: 'md'
        }).then( function(fieldValues){            var payload = { "type": "OUTGOING_SMS", "data": {"to": fieldValues.updatedFields[0].value, "message": fieldValues.updatedFields[1].value}};
            var context = {"payload": payload, "method" : "openframe_communication" };
            CustomEvent.fireAll("openframe_request", context);
            console.log('send message');
        });
    }
}

1 ACCEPTED SOLUTION

Charles Avila
Tera Expert

I have resolved this separately... the error was in the code of the OpenFrame app... nvm...

View solution in original post

1 REPLY 1

Charles Avila
Tera Expert

I have resolved this separately... the error was in the code of the OpenFrame app... nvm...