AnswerBun.com

Journey Builder - custom activity stops journey saving

Salesforce Asked by Bo Wang on July 21, 2020

i have a very simple custom activity that is designed to pass some values to a API endpoint for execution. the activity simply launches a window with url and request body as post vars. the post vars are pushed on clickednext event into the inargments along with couple of basic contact attributes email and phone.

no matter with inargments or not, the journey which has the activity in it won’t save with a contact support error msg. as far as i can tell, on save, journey builder passes over a payload which has the right attributes. for some reason, the backend don’t quite like it.

see postmangor and config.json code below.

{
    "metaData": {
        "icon": "images/jb-icon.jpg",
        "iconSmall": "images/jb-icon.jpg"
    },
    "key": "-----",
    "type": "ContactSpace",
    "workflowApiVersion": "1.1",
    "lang": {
        "en-US": {        
            "name": "ContactSpace",
            "description": "Activity simply posts the data to API endpoint."
        }
    },
    "category": "Custom",
    "version": "1.0",
    "edit": {
        "uri": "index.html",
        "maxHeight": 500,
        "maxWidth": 750,
        "minHeight": 300,
        "minWidth": 450,
        "steps": 1
    },
    "userInterfaces": {
        "configModal": {
            "height": 300,
            "width": 300,
            "fullscreen": false
        }
    },
    "arguments": {
        "execute": {
            "inArguments": [{
                "emailAddress": "{{InteractionDefaults.Email}}"
            },
            {
                "phoneNumber": "{{Contact.Attribute.Person.s360a__PhoneNumberMobilePhoneNumber__c}}"
            },
            {
                "call_body": ""
            },
            {
                "call_url" : ""
            },
            {
                "contactIdentifier" : "{{Contact.Key}}"
            }],
            "outArguments": [],
            "timeout": 100000,
            "retryCount": 1,
            "retryDelay": 10000,
            "concurrentRequests" : 5,
            "url": "somedomain/ixn/activities/someact/execute"
        }
    },
    "configurationArguments": {
        "save": {
            "url": "somedomain/ixn/activities/someact/save",
            "body": "",
            "verb": "POST",
            "useJwt": false
        },
        "publish": {
            "url": "somedomain/ixn/activities/someact/publish"
        },
        "validate": {
            "url": "somedomain/ixn/activities/someact/validate"
        }
    },
    "schema": {
        "arguments": {
            "execute": {
                "inArguments": [
                    {
                        "phoneNumber": {
                            "dataType": "Phone",
                            "isNullable": true,
                            "direction": "in"   
                        }
                    },
                    {
                        "emailAddress": {
                            "dataType": "Email",
                            "isNullable": true,
                            "direction": "in"
                        }
                    },
                    {
                        "contactIdentifier": {
                            "dataType": "Text",
                            "isNullable": true,
                            "direction": "in"
                        }
                    },
                    {
                        "call_body": {
                            "dataType": "Text",
                            "isNullable": true,
                            "direction": "in"
                        }
                    },
                    {
                        "call_url": {
                            "dataType": "Text",
                            "isNullable": true,
                            "direction": "in"
                        }
                    }
                ],
                "outArguments": []
            }
        }
    }
}
connection.on('initActivity', function(data) { 
        console.log('initActivity');
        console.log(data);

        if (data) {
            payload = data;
        }

        var hasInArguments = Boolean(
            payload['arguments'] &&
            payload['arguments'].execute &&
            payload['arguments'].execute.inArguments &&
            payload['arguments'].execute.inArguments.length > 0
        );
        var values;

        if (hasInArguments){
            values = payload['arguments'].execute.inArguments.filter(function( obj ) {
                return obj.hasOwnProperty('call_url') || obj.hasOwnProperty('call_body');
            });
        }

        console.log(values);

        if (values && values.length>0){
            $('#call_url').val( values[0].call_url );
            $('#call_body').val( values[1].call_body );
        }
        
        

    });

    connection.on('clickedNext', function(options) {


        console.log('clickedNext');

        var urlvalue = $('#call_url').val();
        var bodyvalue = $('#call_body').val();

        if( !urlvalue ) {
            console.log('empty value');
            // Notify user they need to select a value 
            $('#helloWorldTriggerConfigError').html('<strong style="color: red;">You must enter something</strong>');
            connection.trigger('ready');
        } else {

            payload['arguments'].execute.inArguments = payload['arguments'].execute.inArguments.filter(function( obj ) {
                return !obj.hasOwnProperty('call_url') && !obj.hasOwnProperty('call_body');
            });


            if (!payload.name) payload.name = 'ContactSpace';
            payload['arguments'].execute.inArguments.push({ "call_url": urlvalue });
            payload['arguments'].execute.inArguments.push({ "call_body": bodyvalue  });
            
            payload['metaData'].isConfigured = true;
            connection.trigger('updateActivity', payload);

            
            connection.trigger('nextStep');
            
        }

    });

Add your own answers!

Related Questions

How to query only accounts that don’t have attachments

1  Asked on January 2, 2022 by akouayri-hamza

       

DX CLI – Custom Settings

1  Asked on January 2, 2022 by treblecode

     

AsyncApexExecutions Limit exceeded different errors

0  Asked on January 2, 2022 by love-gupta

     

Need help finishing flow using ltng:outApp

1  Asked on January 2, 2022 by merry-stambaugh

 

How can we use GetRecordIds in a VisualForce page

1  Asked on December 31, 2021 by sfdclearner

 

Salesforce Convert a Text to a Formula Field

1  Asked on December 31, 2021 by codemonger

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP