Add a "Custom Action" Step
Create (or open) a Campaign Canvas or Program Canvas. Open your Campaign/Program then do the following: 1. Click '>>' in the top left to display the full names 2. Expand the list of steps by clicking in the top-left on the 'Program Steps' or 'Campaign Steps' heading 3. In the expanded list, click the gold star next to Custom Action. This will pin it to the list. Once you've pinned it, simply drag the Custom Action onto your Program/Campaign. You can also double-click.
2. Create Your Action
Click 'configure' on your Custom Action Step.
The Just Add Features app opens.
Click 'New Action'. You will be asked to choose a template to start from. Choose the basic template.
3. Test The Example
You should see a simple code-editor. Without changing anything, press 'Test'.
The test outcome will be displayed on the right. You should see a green 'Success' message appear.
4. Say 'Hello World'
Add one extra line to the top of the sample code:
The built-in eloqua.log("Message here..") function logs anything you need. Save and then re-test your code. You will see a log message appear on the right. Logs also are saved when you run your Actions for real in Campaigns/Programs.
5. Break The Example
Edit the code to break it. E.g. add fakeFunctionCall() or some nonsense to the top. Hit 'Save' then 'Test' again. Now you should see a red error-message appear. This is how error-handling works.
6. Edit Your Action
Remove your deliberate error. Now let's make something! Editing your Action is really simple. Just edit, save, test. You can check it works (and what updates are returned) on the right. Your code needs to call eloqua.done() - this built-in function tells Just Add Features that your Action is finished. You can also pass eloqua.done() an object of field-value pairs, this will send updates back to the Contacts your Action is run on. Here is an example:
7. Use Fields
All the fields Eloqua sends in are available in eloqua.fields. So for example the contact's first name is available on eloqua.fields.C_FirstName.
That example will log out e.g. "Hello Sam".
Before you can use a field, you need to specify that Eloqua should send it. You can do this on the 'Settings' tab. This also tells you which exact field names to use for accessing & updating contact data.
8. Run It
This is the fun bit. Connect your Custom Action step and activate the Program Canvas/Campaign Canvas. Make sure you have something after your Custom Action step, so you can see it worked. Contacts should flow through your Custom Action and receive the updates etc. To view outcome information: open your action and view the 'Logs' tab.