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

Set Padding on Minimum Width [Aura]

1  Asked on October 4, 2021 by al-k

   

restrict past dates in lightning:input

1  Asked on October 4, 2021 by krishna-casukhela

 

Why is SystemModStamp missing updates?

1  Asked on October 4, 2021 by sebthu

 

Marketing Cloud Barcodes

0  Asked on October 4, 2021 by john-green

     

Comments in Salesforce contact email address

0  Asked on October 4, 2021 by andrey-osh

   

SOQL Parser implementation in Apex

1  Asked on October 4, 2021 by robert-ssemann

       

How to find code deprecated by Salesforce?

1  Asked on October 4, 2021 by sf-ninja

   

Ask a Question

Get help from others!

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