Data transformation using Formula mode
Quickwork provides a Logger app and data transformation capabilities essential for optimizing and debugging journeys. Data transformation in Quickwork is enabled through the Formula mode, where the input field and Logger functions as a JavaScript sandbox. This enables various data manipulations, such as date formatting or text case adjustments. This section will explain how to effectively utilize the Formula mode.
For the scenario discussed in the previous section, which is: whenever a GitHub issue with the title containing bug is created, a notification is sent on Slack. Extending it, let us consider that the notification has a deadline (two days from the issue created date) for resolving such issues, and the customer support team must be notified about the deadline through the Slack channel.
To achieve this, the Logger can be utilized for data transformation (to calculate the date two days later than the created date).
✅ Pre-requisites
- Access to Quickwork for configuring trigger and actions.
- An active GitHub account with access to a repository where issues can be created and tracked.
- A Slack account with a configured Slack workspace and dedicated channels for customer support and engineering to receive notifications about GitHub issues.
Data transformation using Logger
- Configure the trigger and actions: Ensure you have an active GitHub repository and a Slack channel for notifications, with the appropriate If condition set up as discussed in the previous section.

- Utilize Logger for data transformation:
- Add a step with the Logger app, selecting the Log a message action, and position it in the If Condition block.
- Change the Message input field to Formula mode.
- Drag the Created At data pill from the GitHub | New issue Trigger into the Message field .
- Enter JavaScript code to calculate a date two days from the created date.
var date = new Date(<Created At> Datapill from Trigger); date.setDate(date.getDate() + 2); // Adds two days to the current date var d = date.getDate(); var m = date.getMonth() + 1; // Add 1 to make the month display correctly var y = date.getFullYear(); var dt = d + "-" + m + "-" + y; // Date string in dd-mm-yyyy'format dt; // Outputs the new date string

-
Execution and testing:
- Click Save & Start to activate the journey.
- Activate the journey and create a new issue in GitHub.
- Observe the loggedMessage in the History tab.
- Check the Slack message.
Data transformation on input fields directly
Quickwork allows for direct transformations within action input fields, converting them from Text to Formula mode to apply necessary transformations. Consider a scenario, when escalation emails are received from customers via Gmail, acknowledge the issue by extracting only the sender's email from the formatted sender field.
-
Set up trigger: Use Gmail Secondary as the trigger app with Get email as the trigger event.
-
Email response handling:
- In the action step for sending an email, convert the To input field from Text to Formula mode.
- Insert the code to parse out the email address from the sender's name.
var s = (<From> Datapill from trigger); var s1 = s.split('\<',2); var s2 = s1[1]; var s3 = s2.split('>',2); var s4 = s3[0]; s4;
-
Execution and testing:
- Test the setup by sending a trigger email.
- Observe that only the sender's email address is extracted and used in the response.
Formula mode
- Must always return a value.
- Return type is limited to string or stringified JSON.
- Best suited for small data transformations or field-level logic.
- Execution timeout: ~1000 ms.
- Datapills can be used directly inside the formula field where the code is written.
- Lightweight and quick for simple tasks.
- If an execution timeout of up to 90 seconds is required or when working with larger payloads, use the NodeJS app.
❓ Troubleshooting
- Validation errors: To avoid runtime errors, ensure all scripts and formulas in the Formula mode adhere to proper JavaScript syntax.
- Incorrect data types: Check that the data types expected by your formulas match the data being processed. For instance, attempting to perform arithmetic operations on non-numeric data will result in errors.
- Formula mode output: Ensure that the value you want to output in Formula mode is the last line in the code content within the field where Formula mode is activated.
- Third party libraries: Third party libraries or packages are not supported in Formula mode.
✏️ Tips and recommendations
- Utilize the Logger extensively to output intermediate values. This practice helps in understanding the flow of data and identifying where things may be going wrong.
- In Formula mode, keep the code concise and avoid overly complex logic that can be hard to debug. Break down complex transformations into simpler, sequential steps if necessary.
📚 Additional resources
Updated 1 day ago