Invoke Trigger in MuleSoft Composer
Composer : Invoke Trigger
MuleSoft Composer is a user-friendly integration tool tailored for admins, business analysts, marketers, salespeople, and team leaders. Its key features include no-code integration, streamlining complex processes without the need for coding. It offers a library of 14 pre-built connectors for popular applications, reducing integration time. Users can also benefit from real-time data previews to ensure integration accuracy before activation and built-in monitoring with automated error alerts for timely issue resolution.
Composer has introduced a powerful feature called “Invoke Trigger” to simplify the execution of flows by triggering them with specific data inputs. This functionality streamlines the process of calling a Composer flow, making it exceptionally user-friendly. Let’s utilize the Invoke Trigger feature in Composer with a straightforward use case.
Consider a scenario where you have a Composer flow intended to transmit data to various end systems without relying on system calls or schedulers. In this case, you can leverage the Invoke Trigger functionality to trigger the flow while providing all the necessary variables to ensure seamless execution.
For instance, let’s examine a specific use case where we are working with Salesforce. Our goal is to update or create contacts within Salesforce, and we will be using a common account ID variable to facilitate this task. Within the Composer flow, we can set up an Invoke Trigger connector, which acts as the entry point for our flow.
Here are the key steps involved:
1. Create Your Composer Flow: Start by designing your Composer flow, which should include all the necessary steps and logic for your data integration or transformation process.
2. Configure the Invoke Trigger: Within your flow, incorporate an Invoke Trigger connector. In this connector, define the fields essential for your process. For example, in our case we are updating/ creating a Salesforce contact object, this might include First Name, Last Name, Email (with email ID as a unique identifier), Phone Number, and any other relevant fields. Additionally, we establish a common account ID variable that will be used consistently throughout the flow.
Invoke trigger Configuration
3. Populate the Value: The fields you created within the Invoke Trigger connector will be used within the salesforce call to update the required fields. This value will be used while calling the flow, and it will subsequently be updated in Salesforce.
4. Test Run: After constructing the flow and implementing all the necessary logic, conduct a test run. This step is crucial for verifying that your flow correctly processes the data and functions as expected.
5. Activation: Upon a successful test run, activate the flow. Activation will provide you with a client ID and a client secret URL, along with the required payload structure within flow credentials for triggering the flow programmatically.
Note: Flow Credentials can be changed as per requirement.
6. Condition to Trigger the Flow: To execute the flow, you must send data with values that precisely match the field names specified in the Invoke Trigger connector. Ensure that the data you send aligns accurately with the defined field names.
7. Trigger the Flow Programmatically: Utilise tools like Postman to programmatically trigger the flow. Use the provided client ID, client secret URL as username and password and payload structure provided in OpenAPI Specification to make the call. This enables you to initiate the flow from other systems or applications by leveraging the provided credentials and data.
8. Monitoring and Logging: Composer offers comprehensive logs that facilitate monitoring the success and failure of triggered calls. Regularly review these logs in the Run History section to ensure that your flow operates as intended and to troubleshoot any issues that may arise.
Let’s also verify our created contact in salesforce.
Yes, so we have successfully automated our flow using invoke trigger.