In select BlueConic connections, you can use the JavaScript data processor to apply custom-written JavaScript code functionality to a data source.
Adding this data processor to your tenant
To use this processor, you first need to add it to your tenant by navigating to BlueConic settings > Plugins, clicking the Add plugin button at the top right, and registering the following external URL:
https://plugins.blueconic.net/preprocessor_javascript/index.xml
For more detailed instructions, review the article Overview: What are BlueConic plugins?. And if you need further assistance, reach out to BlueConic Support.
Adding this data processor to a connection
The JavaScript data processor is available in all BlueConic connections that use data processors. Review the complete list of BlueConic data processors.
Each of these connections has a specific step on its import and/or export goal page to add data processors (e.g., "Correct your files before the import," "Modify your data before the export"). In that step, use the search box to add "JavaScript"; once added, it appears in a numbered list of data processors activated for that connection.
For more information, review the full article Using data processors with BlueConic connections.
Configuring this data processor
The JavaScript data processor requires some configuration to ensure that BlueConic imports or exports the data as specified. To make these configurations, click the cogwheel icon next to "JavaScript" in the numbered list of data processors.
If you choose the “Define JavaScript snippet here” button you can configure the following options:
Input your JavaScript code that will be applied to your data source. The object “data” should be used for your functions. The functions “getValue(dataObject, dotExpression)” and “getValues(dataObject, dotExpression)” can be used to retrieve data.
Test JavaScript: Press this button to test your JavaScript code for errors.
Additional target fields: Optionally specify any additional data fields created within the JavaScript code to be used in the mapping step. For example, if you add ”extra_prop” as a new property to the data source, you have to specify “extra_prop” as an additional target field that will then be available in the mapping step. You can add an additional target field by manual input or automatic detection from the code.
Click OK to save your settings and apply the data processor to your connection.
If you choose the “Select JavaScript snippet from central slide library” button you will see the following options:
Click the (select other) button to choose a JavaScript code snippet from the central library to use in this connection goal.
This will open a window with all of your saved JavaScript snippets. Here, you can:
Choose an existing snippet: This will add the code snippet to the JavaScript data processor in the connection.
Add a new snippet: This will open a new code editor where you can write, edit, and save a JavaScript snippet.
Edit an existing snippet: Click the paintbrush icon in the top right corner of an existing snippet to configure its settings.
Using the central library with the JavaScript data processor
Using the central library feature with the JavaScript data processor offers advantages for code reusability and maintainability. By storing common code snippets in a central location, you can easily reuse them across multiple goals and connections, eliminating redundant coding efforts.
The central library feature ensures that any changes made to a snippet are automatically reflected in all goals that utilize it, streamlining updates and reducing the risk of inconsistencies. This centralized approach also safeguards your valuable code. Since snippets are stored independently, they are protected from accidental deletion when removing a goal or connection, preventing potential data loss and ensuring long-term code preservation.
Deep Dive into the JavaScript Data Processor
For a technical deep dive into how the JavaScript data processor works, see the JavaScript Data Processor Deep Dive page.