You can use eloqua.log("Message here...") anywhere in your action.
This built-in function logs whatever you pass to it. This message will be visible in 2 places:
When you test your feature, it will display in a blue info box
In the 'Logs' tab after your feature runs in a campaign or program
The eloqua.audience function sends an audience back to Eloqua. It does 2 things. 1. The contacts will be imported/updated into your Eloqua database 2. The contacts will be added to your campaign or program Therefore the Custom Audience is useful for both importing and segmenting contacts.
In the above example, eloqua.audience() is passed two hard-coded contacts. These contacts will be created if they do not exist in Eloqua, and whatever fields you pass will be updated. You return an array of contacts. Each contact object needs to have Eloqua's internal fieldname as the key, and the update as the value. The editor makes this process much easier. In the eloqua.audience() you can start typing any field - and Instant Marketing will autocomplete the internal field-names for you! This autocompletion support is actually smart enough to know all the custom fields in your specific instance, and will highlight an error if you pass the wrong type. (E.g. if you try to pass a string to an Eloqua Number field).
This basic example creates/updates one contact, setting their name to 'Bruce Wayne'.
The below sample demonstrates using a Custom Audience to retrieve an audience from an API.
The below example includes an extra step to map results.
This is a real, working example which queries a sample-data site and fetches contacts.
In the 'Action' tab if you click on the more icon ('...'), you can select Advanced Settings. One of these settings is a config object. This is designed for a situation where you want to re-use the same code, but pass different "settings" into it each time. The entire config object is available as eloqua.config - therefore you can access whatever properties you give it:
Again - the config is unique to each instance of your app, and is designed to allow re-use.
You may want to have some values stored outside of your code. E.g. API keys. This can be useful for security (less visible), and also means they can be centrally maintained even if they are used in many functions. You can set global config through the Just Add Features global settings. An object with all the global settings is available as eloqua.globals - therefore you can access whatever global properties you setup: