BassemE/mulesoft-documentation-embeddings huggingface dataset:
Troubleshooting OAuth2 Provider Module | MuleSoft Documentation
# Troubleshooting OAuth2 Provider Module
To troubleshoot OAuth2 Provider module, become familiar with the information about enabling verbose logging and interpreting commonly throw messages.
## Enable Verbose Logging
To get a better understanding of why an application’s interaction with OAuth2 Provider module is failing, temporarily enable verbose logging for the module.
Remember to always disable the enhanced verbosity after troubleshooting, because it affects your Mule application performance.
To enable verbose logging in the configuration file:
  1. Access Anypoint Studio and navigate to the **Package Explorer** view.
  2. Open your application’s project name.
  3. Open the `src/main/resources` path folder.
  4. Open the `log4j2.xml` file inside the folder.
  5. Add an `<AsyncLogger>` tag inside the `<Loggers>` tag:
```
			<Loggers>
				...
				<AsyncLogger name="org.mule.extension.oauth2" level="DEBUG"/>
				...
			</Loggers>
```

  6. Save your application changes.
  7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**.


## Understand Common Throws
Here is a list of common thrown messages and how to interpret them:
  * OAUTH2-PROVIDER:CLIENT_ALREADY_EXISTS
```
A client already exists with the same client ID, and the *Fail If Present* field is set to `true`.
```

  * OAUTH2-PROVIDER:INVALID_CONFIGURATION
```
The provided parameters are invalid, for example, the *Authorized Grant Types* field of `AUTHORIZATION_CODE` does not have a redirect URI.
```

  * OAUTH2-PROVIDER:NO_SUCH_CLIENT
```
The client to delete does not exist.
```

  * OAUTH2-PROVIDER:INVALID_TOKEN
```
The token to revoke is invalid.
```

  * OAUTH2-PROVIDER:TOKEN_UNAUTHORIZED
```
The token is invalid or there are missing or wrong fields set in the validation.
```

  * OAUTH2-PROVIDER:OAUTH_SERVER_SECURITY
```
OAuth2 Provider module throws this error when is unable to identify its reason.
```



## See Also
  * MuleSoft Help Center
  *
flatten | MuleSoft Documentation
# flatten
## flatten<T, Q>(@StreamCapable items: Array<Array<T> | Q>): Array<T | Q>
Turns a set of subarrays (such as `[ [1,2,3], [4,5,[6]], [], [null] ]`) into a single, flattened array (such as `[ 1, 2, 3, 4, 5, [6], null ]`).
Note that it flattens only the first level of subarrays and omits empty subarrays.
### Parameters
Name | Description  
---|---  
The input array of arrays made up of any supported types.  
### Example
This example defines three arrays of numbers, creates another array containing those three arrays, and then uses the flatten function to convert the array of arrays into a single array with all values.
#### Source
```
%dw 2.0
output application/json
var array1 = [1,2,3]
var array2 = [4,5,6]
var array3 = [7,8,9]
var arrayOfArrays = [array1, array2, array3]
---
flatten(arrayOfArrays)
```

#### Output
```
[ 1,2,3,4,5,6,7,8,9 ]
```

### Example
This example returns a single array from nested arrays of objects.
#### Source
```
%dw 2.0
var myData =
{ user : [
  {
   group : "dev",
   myarray : [
    { name : "Shoki", id : 5678 },
    { name : "Mariano", id : 9123 }
   ]
  },
  {
   group : "test",
   myarray : [
    { name : "Sai", id : 2001 },
    { name : "Peter", id : 2002 }
   ]
  }
 ]
}
output application/json
---
flatten(myData.user.myarray)
```

#### Output
```
[
 {
  "name": "Shoki",
  "id": 5678
 },
 {
  "name": "Mariano",
  "id": 9123
 },
 {
  "name": "Sai",
  "id": 2001
 },
 {
  "name": "Peter",
  "id": 2002
 }
]
```

Note that if you use `myData.user.myarray` to select the array of objects in `myarray`, instead of using `flatten(myData.user.myarray)`, the output is a nested array of objects:
```
[
 [
  {
   "name": "Shoki",
   "id": 5678
  },
  {
   "name": "Mariano",
   "id": 9123
  }
 ]
]
```

## flatten(@StreamCapable value: Null): Null
Helper function that enables `flatten` to work with a `null` value.
Creating Alerting Email Templates | MuleSoft Documentation
# Creating Alerting Email Templates
Create a template for an email to send as an alert. Address the email to users within RPA Manager or to other people that must be aware of problems. Use keywords to extract the relevant information from the incident.
Combine targets to target groups to save time when creating alert rules.
## Before You Begin
  * Ask an organization administrator in Access Management to assign you the required permissions:
Action | RPA Permission | Deprecated RPA Permission  
---|---|---  
Open the **Alerting** module. | RPA Operations Viewer, RPA Operations Manager, RPA Administrator | Alerting Open  
Create, edit, and delete alerting targets and rules. | RPA Operations Manager, RPA Administrator | Alerting Administration  


## Create Alert Targets
Create a template for an email to send as an alert. Address the email to users within RPA Manager or to other people that must be aware of problems. Use keywords to extract the relevant information from the incident.
  1. In the **Alert Targets** view of the **Alerting** module, click **Create**.
  2. Complete the form **Create a new email target** :
     * **Keywords** :
Click on the **Keywords** icon to add placeholders to the subject or the body of the email. The placeholders are filled with the actual values when RPA Manager sends the emails.
  3. Click **Save**.


## See Also
  *   * Defining Rules for Alerts
Salesforce Composite Connector 2.15 | MuleSoft Documentation
# Salesforce Composite Connector 2.15
Anypoint Connector for Salesforce Composite enables you to work with the Salesforce Batch and SObject Tree APIs. The connector exposes convenient methods for preparing subordinate requests, executing them in one batch, and parsing the results.
Salesforce Composite Connector also enables you to create SObject trees by using the **Create sobject tree** operation, which is separate from the batch operations.
This connector provides DataSense for execution and to:
  * Prepare subordinate requests and then parse the responses
  * Create SObject trees


For compatibility information and fixed issues, see Salesforce Composite Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * The Salesforce Composite API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Credentials to access the Salesforce Composite target resource
  * Anypoint Studio version 7.0 or later


## Authentication Types
Salesforce Composite Connector connections use the following authentication types:
  * OAuth v2.0
  * OAuth JWT
  * OAuth SAML
  * OAuth Username and Password
  * Token Connection


For information about configuring these authentication types, see Using Anypoint Studio to Configure Salesforce Composite Connector.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * MuleSoft Help Center
MCP Support Policy | MuleSoft Documentation
# MCP Support Policy
**Policy Name** | MCP Support  
---|---  
Adds MCP support to a Flex Gateway MCP server instance. This policy is required for your MCP server instance to function properly.  
**First Flex Gateway version available**  
**Returned Status Codes** | No return codes exist for this policy.  
This policy supports Model Context Protocol (MCP) version 2025-06-18 and earlier. To learn more about MCP, see MCP Specification.   
---  
## Summary
The MCP Support Policy configures Flex Gateway to support MCP server instances. You must apply this policy to all MCP server instances for the instance to function properly. If you don’t apply this policy, Flex Gateway might throw a runtime error.
There are no configuration parameters for this policy.
This policy must come first in policy order. If this policy doesn’t come first, Flex Gateway might throw a runtime error.   
---  
### Flex Gateway Local Mode
The MCP Support policy isn’t supported in Local Mode.
Usage Reports Release Notes | MuleSoft Documentation
# Usage Reports Release Notes
Each Anypoint Platform organization subscribes to a specific pricing, usage, and packaging model. Some functionality within Anypoint Platform depends on your organization’s setup and provisioning.
The following release notes are provided for pricing, usage, and packaging:
  * Usage Reports Release Notes
Modularize Configuration Files | MuleSoft Documentation
# Modularize Configuration Files
Though it might seem convenient to keep your Mule configurations in one file, a very large XML file quickly becomes unmanageable. This is why MuleSoft recommends that you split monolithic configurations into several files, and leverage Mule’s capacity to load multiple configuration files at application start-up time. Splitting configurations into multiple files encourages reuse across teams.
Mule offers two options for loading multiple configuration files:
  * Side-by-side: Provide a list of independent configuration files to load.
  * Imported: Have one configuration file import several others, which in turn, can import other files.


In practice, it’s common to use both approaches simultaneously.
Because configuration files are loaded in the same context, you must use unique names for the configuration elements. Mule will not load an application if its configuration files have name conflicts.
Here are some suggested ways to determine where to split configuration elements into separate files and which elements to keep together:
  * Business domains usually form a natural border that you can use to separate configuration elements.
  * Keep together elements that have been changed for similar reasons. This reduces the risk of impacting unrelated aspects of your application.
  * Technical elements, such as administrative components, security, and external system configurations determine good separation lines.
  * Separate a side-by-side connector configuration to facilitate functional testing. (This suggestion does not apply to environment-specific connector configurations, which use properties files.)
  * Consider reuse across teams and projects when you separate configuration elements.


By default, Mule treats all XML configuration files as configurations when an application is packaged and loaded in the side-by-side fashion.   
---  
## Imported configuration files
Mule has a special `import` configuration component for importing configuration files into each other. This component takes a `file` parameter, which contains the reference to the desired configuration file.
The following example shows a main configuration file that imports three other configuration elements: `global-configurations.xml`, `admin-config.xml`, and `audit-flows.xml`
```
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://www.mulesoft.org/schema/mule/core"
   xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
  <import file="global-configurations.xml"/>
  <import file="admin-config.xml"/>
  <import file="audit-flows.xml"/>
</mule>
```

The import mechanism requires that the XML files are in the classpath.   
---  
## See also
  * Introduction to Mule 4: Packaging Applications
Secret Groups | MuleSoft Documentation
# Secret Groups
A _secret group_ is a logical grouping of secrets that enables you to manage a group of secrets as a unit. Secrets Manager stores your secrets per secret group, per environment, and per business group.
A maximum of 25 secret groups are allowed per environment per business group. Each secret group can contain a maximum of 350 secrets.   
---  
User access and authorization controls are applied at the environment level. A user who has access on a given environment can access all the secret groups that belong to that environment. Only applications deployed to those specific business groups and environments within your organization can access the secrets stored in each secret group.
## See Also
  *   * Secrets Manager Permissions
  * Create and Edit a Secret Group
CLI for Anypoint DataGraph | MuleSoft Documentation
# CLI for Anypoint DataGraph
Anypoint CLI supports managing these DataGraph features:
  * DataGraph API Source Management
  * DataGraph Load Balancers
nameSet | MuleSoft Documentation
# nameSet
## nameSet(obj: Object): Array<String>
Returns an array of keys from an object.
_This function is**Deprecated**. Use dw::Core::namesOf, instead._
### Parameters
Name | Description  
---|---  
The object to evaluate.  
### Example
This example returns the keys from the input object.
#### Source
```
%dw 2.0
import * from dw::core::Objects
output application/json
---
{ "nameSet" : nameSet({ "a" : true, "b" : 1}) }
```

#### Output
```
{ "nameSet" : ["a","b"] }
```
substringAfter | MuleSoft Documentation
# substringAfter
## substringAfter(text: String, separator: String): String
Gets the substring after the first occurrence of a separator. The separator is not returned.
_Introduced in DataWeave version 2.2.0._
### Parameters
Name | Description  
---|---  
The input string.  
`separator` | String to search for.  
### Example
This example shows how `substringAfter` behaves with different inputs and sizes.
#### Source
```
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
 "a": substringAfter(null, "'"),
 "b": substringAfter("", "-"),
 "c": substringAfter("abc", "b"),
 "d": substringAfter("abcba", "b"),
 "e": substringAfter("abc", "d"),
 "f": substringAfter("abc", "")
}
```

#### Output
```
{
 "a": null,
 "b": "",
 "c": "c",
 "d": "cba",
 "e": "",
 "f": "abc"
}
```

## substringAfter(text: Null, separator: String): Null
Helper function that enables `substringAfter` to work with a `null` value.
_Introduced in DataWeave version 2.2.0._
Creating Namespaces for Application Deployments | MuleSoft Documentation
# Creating Namespaces for Application Deployments
Anypoint Runtime Fabric version 1.12 or later enables you to create your own namespaces for application deployments.
When you deploy an application into an Anypoint Platform environment, Runtime Fabric creates a new default namespace using the identifier of the environment. However, if you can create or modify a namespace with the appropriate Kubernetes labels, Runtime Fabric deploys applications into that namespace instead of into the default namespace.
## Create A Namespace
  1. As a user with permissions to create a namespace, log in to a Kubernetes workstation.
  2. Run the following commands:
```
kubectl create ns <app_namespace>
kubectl label ns <app_namespace> rtf.mulesoft.com/agentNamespace=<rtf_namespace> rtf.mulesoft.com/role=workers rtf.mulesoft.com/envId=<environment_id> rtf.mulesoft.com/org=<org_id>
```

     * Replace `<app_namespace>` with the name of your namespace.
     * Replace `<rtf_namespace>` with the name of the namespace containing the RTF agent.
     * Replace `<environment_id>` with the correct ID for your environment.
     * Replace `<org_id>` with the correct ID for your Business Group.


After you run these commands, any application deployed into an Anypoint Platform environment identified by `<environment_id>` and `<org_id>` is created inside the `<app_namespace>` namespace by the RTF agent running in the `<rtf_namespace>`. Before you deploy any applications into the new namespace, delete any autogenerated namespaces and any applications in them that use the same environment ID as the new namespace. Do not use the <rtf_namespace> to deploy your Mule app.
## Troubleshooting Custom Namespaces
If you encounter errors when attempting to create namespaces for Runtime Fabric, troubleshoot them as follows.
### More Than One Namespace Uses the Same Environment ID
Imagine that you created more than one namespace using the same environment ID, as shown in the following example:
```
$ kubectl get ns custom-namespace-1 -oyaml
labels:
  rtf.mulesoft.com/envId: b164ad54-7e15-4c8b-a7ab-18011a361d81
  rtf.mulesoft.com/role: workers
  rtf.mulesoft.com/agentNamespace=rtf
  rtf.mulesoft.com/org=70be136d-28ec-4395-883f-e5b777a00abc
$ kubectl get ns custom-namespace-2 -oyaml
labels:
  rtf.mulesoft.com/envId: b164ad54-7e15-4c8b-a7ab-18011a361d81
  rtf.mulesoft.com/role: workers
  rtf.mulesoft.com/agentNamespace=rtf
  rtf.mulesoft.com/org=70be136d-28ec-4395-883f-e5b777a00abc
```

In such cases, Runtime Fabric fails the deployment and creates an error message in Runtime Manager.
Before you delete a namespace, ensure that you have not deployed any production applications into that namespace.
MuleSoft Accelerator for Consumer Goods | MuleSoft Documentation
# MuleSoft Accelerator for Consumer Goods
MuleSoft Accelerator for Consumer Goods helps consumer goods companies integrate their digital operations to gain visibility into trade promotion management and retail execution. Our foundational assets are expertly designed to jumpstart your top integration and business initiatives so that IT teams can spend more time innovating and less time building from scratch.
## Use Cases
### Product and Account Integration with Hierarchies
The Product and Account Integration with Hierarchies use case surfaces relevant product, customer, demand planning, and pricing information from ERP and PIM systems and easily consolidate this information into Trade Promotion Management (TPM) platforms like Salesforce Consumer Goods Cloud for informed promotional planning.
### Retail Execution
The Retail Execution use case unlocks shelf data to enable perfect retail execution with pre-built assets. Access store audit data from image recognition software, like Trax, and smoothly integrate into Retail Execution platforms, such as Salesforce Consumer Goods Cloud, to monitor at shelf performance in one platform.
### Trade Promotion Effectiveness
The Trade Promotion Effectiveness use case allows you to visualize your promotions in one integrated platform with pre-built assets that integrate Business Intelligence Tools (BI Tools), such as CRM Analytics, into a TPM platform like Salesforce Consumer Goods Cloud.
### Trade Promotion Optimization
The Trade Promotion Optimization use case allows you to visualize your promotions in one integrated platform with pre-built assets that integrate Business Intelligence Tools (BI Tools), such as CRM Analytics, into a TPM platform like Salesforce Consumer Goods Cloud.
### POS Integration
The POS Integration use case enables retail developers to leverage pre-built integrations to connect order and loyalty data from Point of Sale (POS) systems to Data Cloud.
## See Also
  *   *   *   * MuleSoft Accelerator for Consumer Goods on Exchange
Health Check Policy | MuleSoft Documentation
# Health Check Policy
**Policy name** | Health Check  
---|---  
Monitors API upstream health at specific intervals  
Quality of Service  
**First Flex Gateway version available**  
**Returned Status Codes** | No return codes exist for this policy.  
## Summary
The Health Check policy enables you to monitor an API instance’s connection to an upstream service and sends you an email alert if the connection status changes. The Health Check policy monitors the health of the upstream service and not the health of the API instance or Flex Gateway.
The Health Check policy monitors your API by making GET requests to the specified upstream’s base path. You must specify a base path with a GET request. Requests are made at a fixed schedule every minute with the first request. The first request occurs a minute after the policy is applied. Requests made by the Health Check policy do not count as Flex Gateway API calls for pricing purposes.
When you configure Health Check, specify a response code for the GET request that indicates a healthy connection. For example, the status code of an active API should return 200, indicating the API can receive connections. The platform sends an email alert when the status code is not 200. Health Check only validates the response code, so what is returned to the endpoint is unimportant.
No logging event appears for healthy responses. Flex Gateway logs only unhealthy responses.
You can use any 1xx, 2xx, 3xx, 4xx, or 5xx response codes. However, if you expect successful connections to your endpoints, 2xx response codes are ideal. Only a number response code is accepted.
You are required to create an alert for the Health Check policy. Applying the policy navigates you to the Create Alert page, where you must create an alert. For information about how to configure your alert, visit Using Flex Gateway API Alerts.
Applying the Health Check policy to API Instances with an outbound TLS context also applied causes the Health Check policy to return an unhealthy connection.   
---  
## Configuring Policy Parameters
### Flex Gateway Local Mode
The Health Check policy isn’t supported in Local Mode.
### Managed Flex Gateway and Flex Gateway Connected Mode
When you apply the policy to your API instance from the UI, the following parameters are displayed:
Element | Description | Required?  
---|---|---  
Upstream URL |  The full URL of the API upstream you are monitoring  
The HTTP path of the GET method that is requested during health checks  
Response code |  The expected status code of the GET request specified in the base path. Only a number response code is accepted.
Zuora AQuA Connector Studio Configuration | MuleSoft Documentation
# Zuora AQuA Connector Studio Configuration
To configure a connector in Anypoint Studio, follow this process:
  1. Add the connector to your Mule project.
  2. Configure the connector.
  3. Configure an input source for the connector.


## Add the Connector to Your project
Anypoint Studio provides two ways to add the connector to your Mule project:
  * From the Exchange button in the Studio taskbar
  * From the Mule Palette view


### Add the Connector Using Exchange
  1. In Studio, create a Mule Project.
  2. Click the Exchange **(X)** icon in the upper-left of the Studio task bar.
  3. In Exchange, click **Login** and supply your Anypoint Platform username and password.
  4. In Exchange, search for **Zuora AQuA**.
  5. Select the connector and click **Add to project**.
  6. Follow the prompts to install the connector.


### Add the Connector in Studio
  1. In Studio, create a Mule project.
  2. In the Mule Palette view, click **(X)** Search in Exchange*.
  3. In **Add Modules to Project** , type "Zuora AQuA" in the search field.
  4. Click this connector’s name in **Available modules**.
  5. Click **Add**.
  6. Click **Finish**.


## Configure an Input Source
Configure an input source for the connector, such as an operation for this connector, **HTTP Listener** , or **Scheduler**.
## Configure the Connector
To configure this connector:
  1. Drag a connector operation into the Studio canvas.
  2. To create a global element for the connector, set these fields:
     * **Username** : Zuora username
     * **Password** : Zuora password
     * **Base Uri** : Base path of the AQuA API for your instance. For example: `https://rest.apisandbox.zuora.com:443/`


## Next Step
After configuring this connector in Studio, see the Zuora AQuA Examples section to experiment with the Zuora AQuA connector.
## See Also
MuleSoft Help Center
SAP S/4HANA SOAP Connector 2.4 - Get Started | MuleSoft Documentation
# SAP S/4HANA SOAP Connector 2.4 - Get Started
Anypoint Connector (SAP S/4HANA SOAP Connector) provides full support for the SOAP APIs exposed by SAP S/4HANA Cloud ERP, and starting with version 2.1, also provides support for SAP S/4HANA on-premise ERP. This connector enables you to automatically discover SOAP services enabled on your SAP S/4HANA instance and to invoke the SOAP service and associated operations.
For software requirements and compatibility information, see the SAP S/4HANA SOAP Connector Release Notes.
## Before You Begin
Before you create an app and use this connector, you must:
  * Have a developer account or other valid SAP S/4HANA instance.
  * Have a MuleSoft Enterprise license.
  * Enable discovery service in your SAP S/4HANA instance.
  * Have a communication user that is assigned to the corresponding communication arrangements for the desired APIs.
  * Be familiar with:
    * SAP S/4HANA SOAP
    * Mule runtime engine (Mule)
    * Anypoint Connectors
    * Anypoint Studio essentials


## Common Use Cases For the Connector
Send an XML request to SAP S/4HANA’s SOAP API and print a response.
## Using Exchange Templates and Examples
Anypoint Exchange provides templates you can use as a starting point for your app, as well as examples that illustrate a complete solution.
## Next Step
After you complete the prerequisites and experiment with templates and examples, you are ready to create an app with Anypoint Studio.
## See Also
  * Introduction to Anypoint Connectors
  * SAP S/4HANA SOAP Connector Release Notes
  * SAP S/4HANA SOAP Connector on Exchange
  * MuleSoft Help Center
Before You Begin Using APIkit for SOAP | MuleSoft Documentation
# Before You Begin Using APIkit for SOAP
Before setting up the development environment for creating a WSDL-based API using APIkit, ensure you fulfill the following prerequisites:
  * Install the following software:
    * Studio 7.1 or later
    * Mule runtime engine 4.1.1 or later
    * APIkit for SOAP 1.1 or 1.2
Studio includes the Anypoint APIkit SOAP extension.
  * Download and install a SOAP client.
For example, SoapUI.
  * Download or obtain the URL for a WSDL file.
For example, WSDL tshirt2.wsdl.


## See Also
  * Implementing a SOAP Interface
Hardening Runtime Fabric | MuleSoft Documentation
# Hardening Runtime Fabric
To enhance the security of Anypoint Runtime Fabric and reduce vulnerabilities, review the following topics:
  * Securing Runtime Fabric Secure your Runtime Fabric by learning about Runtime Fabric security architecture, configuring authorized namespaces, enabling FIPS 140-2, using a local registry, and hardening Mule runtime engine for Runtime Fabric.
  * Configuring Kubernetes for Runtime Fabric Review Kubernetes (K8s) best practices such as scalability benchmarks and cluster configurations. Additionally, check `rtfctl` Kubernetes permissions, review Kubernetes Hardening Guide, and customize Mule apps Kubernetes resources.
  * Backing Up and Restoring Runtime Fabric Use the `rtfctl` command line tool to back up and restore Runtime Fabric services.


## See Also
  * Setting Up Runtime Fabric
  * Managing Runtime Fabric
Building a Flow Using Templates | MuleSoft Documentation
# Building a Flow Using Templates
You can create a new flow from a template.
Templates are patterns that you can leverage to build a flow. All of the steps and field mappings are predefined, so you can select the template and enter the missing information for the various connectors used (such as connection secrets) to create a flow you can later customize to meet your business needs. For example, you might still need to add required fields specific to your connection, map additional fields, or add or delete steps to meet your use case. You will likely still need to make a few changes before activating the flow.
Since templates are pre-built flows, templates not only reduce the barrier to entry and accelerate the time to activate the flow, but also include the best practices for flows.
Some examples of templates include:
  * Cloud-specific templates, such as Service Cloud or Revenue Cloud
  * Connector-specific templates, such as Salesforce, ServiceNow, NetSuite, or Jira


You can search for templates (by template name, connector name, or template description) and filter templates (by use case category or connector).
For more information about how to create a new flow from template, refer to Create a New Flow From Template.
Since you will likely need to further customize your flow from a template, consider the following recommendations and guidelines when encountering messages while customizing your flow from a template. 

Instance Requires Different Fields
    
Your instance might have fields that are different from the template. For example, you might need to add a required field that is not used or delete a field used in the template that does not exist in your connection. These errors must be resolved before testing the flow. 

Field Does Not Exist With Your Connection
    
The `This field does not exist with your connection` message appears if the input field is not present in your connection. For example, when creating custom fields defined in the prerequisites, the ID of the custom field saved in the template differs from the ID of the custom field created in the instance (even if the name is the same), which causes an error to occur in the flow. You can delete the custom field saved in the template and then re-add your custom field from the field selector. 

Value Does Not Exist With Your Connection
    
The `This value does not exist with your connection` message appears if the output field (data pill) is not present in your connection. For example, when creating custom fields defined in the prerequisites, the ID of the custom field saved in the template differs from the ID of the custom field created in the instance (even if the name is the same), which causes an error to occur in the flow. You can remove the mapped data pill and select your custom field from the dropdown.
## See Also
  * Mulesoft Composer: Overview
  * MuleSoft Composer: Getting Started
  * Composer Connector Reference
  * Knowledge Articles
filterArrayLeafs | MuleSoft Documentation
# filterArrayLeafs
## filterArrayLeafs(value: Any, criteria: (value: Any, path: Path) -> Boolean): Any
Applies a filtering expression to leaf or `Path` values of an array.
The leaf values in the array must be `SimpleType` or `Null` values. See Core Types for descriptions of the types.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
An input value of `Any` type.  
Boolean expression to apply to `SimpleType` or `Null` leaf values of all arrays in the input `value`. If the result is `true`, the array retains the leaf value. If not, the function removes the leaf value from the output.  
### Example
This example shows how `filterArrayLeafs` behaves with different inputs.
#### Source
```
%dw 2.0
import * from dw::util::Tree
var myArray = [1, {name: ["", true], test: 213}, "123", null]
output application/json
---
{
  a: myArray filterArrayLeafs ((value, path) ->
    !(value is Null or value is String)),
  b: myArray filterArrayLeafs ((value, path) ->
    (value is Null or value == 1)),
  c: { a : [1,2] } filterArrayLeafs ((value, path) ->
    (value is Null or value == 1)),
  d: myArray filterArrayLeafs ((value, path) ->
    !isArrayType(path))
}
```

#### Output
```
{
 "a": [
  1,
  {
   "name": [
    true
   ],
   "test": 213
  }
 ],
 "b": [
  1,
  {
   "name": [
   ],
   "test": 213
  },
  null
 ],
 "c": {
  "a": [
   1
  ]
 },
 "d": [
  {
   "name": [
   ],
   "test": 213
  }
 ]
}
```
Best Practices | MuleSoft Documentation
# Best Practices
API adoption relies heavily on well-written documentation and maintenance. Ensure that you have a good API strategy.
For optimal performance and experience, follow these best practices from MuleSoft:
  * API Development Best Practices - MuleSoft
  * Best Practices for Planning, Designing, and Managing APIs
  * Best Practices to Design Your First API Specification
  * How to Design and Manage APIs - MuleSoft
Testing with Environment Properties | MuleSoft Documentation
# Testing with Environment Properties
Anypoint Code Builder 
Anypoint Studio 
Assume that you have the following flow that obtains data from an external API and you need to consume it from a test environment when executing your MUnit tests:
```
<http:request-config name="HTTP_Request_configuration">
	<http:request-connection host="sampleapi.com/api/v1/" port="80"/>
</http:request-config>
<flow name="requestApiFlow">
	<http:request method="GET" config-ref="HTTP_Request_configuration" path="/employee"/>
</flow>
```

To consume data from a QA API endpoint when running your MUnit tests:
  1. Extract the HTTP Configuration values into a properties file for each environment where you will execute the validations. Those properties files must go under `src/main/resources`:
prod.properties
```
http.host=dummy.restapiexample.com/api/v1/
http.port=80
```

qa.properties
```
http.host=dummy.qax.restapiexample.com/api/v1/
http.port=8081
```

You can set a properties file for each one of your environments.
  2. Use a `configuration-properties` global configuration in your configuration file to load environment properties from the previously created file:
```
 <configuration-properties file="${mule-env}.properties"/>
```

  3. Replace the HTTP configuration with placeholders matching the variables defined in the properties file:
```
<http:request-config name="HTTP_Request_configuration">
	<http:request-connection host="${http.host}" port="${http.port}"/>
</http:request-config>
<flow name="requestApiFlow">
	<http:request method="GET" config-ref="HTTP_Request_configuration" path="/employee"/>
</flow>
```

  4. Define an environment variable in the MUnit Maven plugin:
```
 <configuration>
   ...
   <environmentVariables>
     <mule-env>qa</mule-env>
   </environmentVariables>
   ...
 </configuration>
```

During the execution of the MUnit tests, MUnit loads the properties from the `qa` properties file and connects to your test environment.
Reassigning RPA Assets | MuleSoft Documentation
# Reassigning RPA Assets
This topic is affected by the Anypoint Platform integration.
If an RPA user or team is deleted or disabled in Access Management, the **Reassign Assets** tab in the **Admin Settings** view of the **Settings** module shows RPA assets that were assigned to this user or team.
All users with the **Reassign Users** or **RPA Administrator** permission get an email when an RPA asset is orphaned because its last assigned user is deleted.
The **Reassign Assets** tab can also show all RPA assets of an existing user.
You can reassign the following RPA assets to another user:
  * Credentials
  * Process Evaluations
  * Process Projects
  * Process Board Tasks
  * Alert Targets


The following assets are deleted on the deletion of the user:
  * Private dashboards
  * User API Keys


User Tasks are not shown in the **Reassign Assets** view and can be reassigned via the **Unprocessed User Tasks** view or via the run configurations of a process.
## Before You Begin
  * Ask an organization administrator in Access Management to assign you the required permissions:
Action | RPA Permission | Deprecated RPA Permission  
---|---|---  
View configured settings for your organization. | RPA Administrator | Organization Management Open  
Add or modify settings for your organization. | RPA Administrator | Organization Management Administration  
Reassign RPA Assets. | RPA Administrator | Reassign Users  
  * Ensure that the user to whom you reassign an asset has the required permissions and knowledge to handle that asset.


## Reassign One RPA Asset
Reassign one asset to another user:
  1. Open the **Reassign Assets** tab in the **Admin Settings** view of the **Settings** module.
  2. To reassign an asset of an existing user, click the **Unassigned assets** drop-down and select the user. You can also search for the user’s name to filter the list.
  3. Click the **Reassign** on the panel of the asset to reassign.
  4. Check and edit the **Reassign Owner** form:
     * In **Assign To** , select a user.
     * Select **Send email to the new owner** to inform the selected user about the reassignment.
  5. Click **Save**.


RPA Manager removes the reassigned asset from the list.
A toast message informs you about the success of the reassignment.
## Reassign Several RPA Assets to One User
Reassign several assets to another user at once:
  1. Open the **Reassign Assets** tab in the **Admin Settings** view of the **Settings** module.
  2. To reassign assets of an existing user, click the **Unassigned assets** drop-down and select the user. You can also search for the user’s name to filter the list.
  3. Check the panel of every asset to reassign.
  4. Check and edit the **Reassign Owner** form:
     * In **Assign To** , select a user.
     * Select **Send email to the new owner** to inform the selected user about the reassignment.
  5. Click **Save**.


RPA Manager removes the reassigned asset from the list.
A toast message informs you about the success of the reassignments.
## See Also
  *
Publishing Flex Gateway MCP and A2A Server instances | MuleSoft Documentation
# Publishing Flex Gateway MCP and A2A Server instances
Similar to API instances, use **API Manager** to publish MCP and A2A Server instances for Managed Flex Gateway or Flex Gateway running in Connected Mode.
For more information, see:
  * Adding a Flex Gateway MCP Server Instance
  * Adding a Flex Gateway A2A Server Instance


## See Also
  * Publishing Managed Gateway and Connected Mode APIs
  * Flex Gateway Overview
yesterday | MuleSoft Documentation
# yesterday
## yesterday(): Date
Returns the date for yesterday as a `Date` type.
_Introduced in DataWeave version 2.4.0._
### Example
This example shows the output of `yesterday` function.
#### Source
```
%dw 2.0
import * from dw::core::Dates
output application/json
---
yesterday()
```

#### Output
Exit Workflow | MuleSoft Documentation
# Exit Workflow
The _Exit Workflow_ action step allows you to end a Workflow in a controlled manner. Use it to end the Workflow with precision at a certain point. This means that even if you have entered possible retries in _Workflow Properties_ or in the _Workflow Wizard_ under _Workflow Exec Tries_ these will be disregarded. As a result you can define exit points anywhere. This function is mainly required in the RPA environment.
## Properties
The _Exit Workflow_ action step has precisely one property. This can be set either under Properties or directly within the wizard:
**Exit severity**
This is where you define the status for the Workflow that you are ending. You can choose between OK and Error. The default is Error.
  * _Error:_ In this case the exit code 120 will be shown. In RPA Manager, for example in the Schedule Run Results _,_ this Workflow is shown as failed (red). In the Workflow Run Results in RPA Builder it will be noted that this involves a user exit.
  * OK: In this case the exit code 500 will be shown. Unlike with the error status, here the Workflow is deemed to have ended successfully. In RPA Manager there will be a warning (yellow) shown for it. As in a normal case, there will be a check whether timers/checkpoints could not be measured. The Workflow Run Results in RPA Builder will be annotated accordingly.


For a description of exit codes, please see **Section Exit Codes**.
## Inbound Variables
The _Exit Workflow_ action step possesses no inbound variables.
## Outbound Variables
The _Exit Workflow_ action step possesses no outbound variables.
## Wizard
See Properties.
Using Variables | MuleSoft Documentation
# Using Variables
Variables are powerful tools that allow you to save and use values throughout your Workflow. You can predefine variables (the _Login Data_ in your _Workflow_ for example) or create variables at runtime (by using _Read Clipboard_ for example) and then use these variables within other action steps. Think of a variable as a placeholder for any text/numeric constant, or value. When creating the _Workflow_ , you can create variables and use them as placeholders. During execution, these variables will be resolved to the value you gave them or that you want to assign to during execution. For example, if _Read Clipboard_ is used, then the clipboard content at that point during execution will be transferred to a variable and any action step referencing that variable will then use the value transferred.
## Pin Variables
Pin variables are used by creating a mapping between one set of action step properties and another action step variable. If this option is available, a little pin will be shown on the action step that can be mapped to:
In the example above, _Read Clipboard_ provides a variable which can then be subsequently used by _Ping_. This is indicated by the pin icon on the right-hand side of the _Ping_ element. Click on the pin to open the _Edit Variable Mappings_ wizard:
Here you can see a list of all _Ping_ properties that can be mapped to. Each property has an adjacent drop-down box containing all variables which can be mapped to the associated property. To map a variable, simply select it from the drop-down box. The variables which can be allocated may change depending on the position of the action step. A variable can only be allocated to the property "Suffix" within a configured _File Controlled Loop_. Other variables are limited to one _Transaction_. This limitation can be overcome using the _Variable_ action step. When you close the wizard, you will see that there is now an active mapping, indicated by a black pin:
You can also view a list of all other action steps that a particular action step has taken variables from.
To do this, open the context menu for the action step of interest by right-clicking on the _Workbench_ , then select the entry _Mapped to action step_. The list will be displayed as a sub-menu.
Clicking on an element in this sub-menu will take you directly to the corresponding action step.
DataWeave Extension | MuleSoft Documentation
# DataWeave Extension
DataWeave enables you to implement and test your custom DataWeave modules and mappings and package them into libraries that you can share and reuse through Anypoint Exchange.
The DataWeave extension to Visual Studio Code enhances productivity when you’re building DataWeave libraries. The extension provides the following capabilities:
  * Ability to work on your DataWeave modules and mappings in a standalone manner, outside of a Mule application.
  * Instant execution of your DataWeave mappings, including live preview of data transformations.
  * Language support, including autocompletion, navigation, refactoring, formatting, quick fixes, and syntax highlighting.
  * Debugging support for DataWeave mappings.
  * Automatic generation of a documentation template that you can use to provide your own DataWeave library documentation in Exchange.
  * An embedded DataWeave Maven plugin with the following features:
    * Integration of packaging and deployment of your DataWeave libraries with your Maven lifecycle.
    * Integration with Exchange to share and consume DataWeave libraries.
  * An embedded DataWeave testing framework that enables you to build automated unit and integration tests easily.


## See Also
Create Custom Modules and Mappings
toDate | MuleSoft Documentation
# toDate
## toDate(str: String, formatters: Array<Formatter>): Date
Transforms a `String` value into a `Date` value using the first `Formatter` that matches with the given value to transform.
_Introduced in DataWeave version 2.5.0._
### Parameters
Name | Type | Description  
---|---|---  
The `String` value to transform into a `Date` value.  
`formatters` | Array<Formatter> | The `array` of formatting to use on the `Date` value.  
### Example
This example shows how `toDate` behaves with different inputs. It produces output in the `application/dw` format.
#### Source
```
%dw 2.0
import * from dw::util::Coercions
import * from dw::Runtime
output application/dw
---
{
 a: toDate("2023-28-03", [{format: "yyyy/MM/dd"}, {format: "yyyy-dd-MM", locale: "en_US"}]),
 b: try(() -> toDate("2023-28-03", [{format: "yyyy/MM/dd"}])).error.message
}
```

#### Output
```
{
 a: |2023-03-28| as Date {format: "yyyy-dd-MM", locale: "en_US"},
 b: "Could not find a valid formatter for '2023-28-03'"
}
```

## toDate(str: String, format: String | Null = null, locale: String | Null = null): Date
Transforms a `String` value into a `Date` value and accepts a format and locale.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
The `String` value to transform into a `Date` value.  
The formatting to use on the `Date` value. A `null` value has no effect on the `Date` value. This parameter accepts Java character patterns based on ISO-8601. A `Date` value, such as `2011-12-03`, has the format `uuuu-MM-dd`.  
Optional ISO 3166 country code to use, such as `US`, `AR`, or `ES`. A `null` or absent value uses your JVM default.  
### Example
This example shows how `toDate` behaves with different inputs. It produces output in the `application/dw` format.
#### Source
```
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
 a: toDate("2015-10-01"),
 b: toDate("2003/10/01","uuuu/MM/dd")
}
```

#### Output
```
{
 a: |2015-10-01|,
 b: |2003-10-01| as Date {format: "uuuu/MM/dd"}
}
```
Google Calendar Connector 1.2 | MuleSoft Documentation
# Google Calendar Connector 1.2
Anypoint Connector for Google Calendar (Google Calendar Connector) synchronizes data and automates business processes between Google Calendar and third-party applications, either on-premises or in the cloud.
Google Calendar is a calendar and task planning application that focusses on enhancing personal and team productivity. Using Google Calendar, individuals can easily schedule tasks and meetings. They can also share events with colleagues through an easy-to-use calendar interface.
For compatibility information and fixed issues, see the Google Calendar Connector Release Notes.
## Before You Begin
To use this connector, you should be familiar with:
  * The Google Calendar API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Credentials to access Google Calendar
  * Anypoint Studio version 4.2.1 or later


## Common Use Cases for the Connectors
Common use cases for Google Calendar Connector include the following:
  * Improve scheduling efficiency


Remove the manual effort of scheduling events that are part of established processes. For example, you can create a 15-minute triage meeting automatically whenever a high-severity customer issue is received.
  * Enhance employee productivity


Sync event details, such as customer calls, from external systems like Trello, Asana, and other task planning apps into Google Calendar so that individuals have all of their scheduled engagements in one place.
  * Streamline collaboration


Integrate your team calendar with your team channel on messaging systems like Slack and Teams so that anytime you schedule a new event on your team calendar, your team receives a notification.
## Authentication Types
Google Calendar Connector uses the OAuth 2.0 authentication type, which uses access tokens provided by the authorization server to get access to protected data.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * MuleSoft Help Center