BassemE/mulesoft-documentation-embeddings huggingface dataset:
Header Removal Policy | MuleSoft Documentation
# Header Removal Policy
API Manager supports policies for removing HTTP headers from a request or response. The policies take effect before sending the request or response. The Header Removal policy performs the following actions:
  * Prevents receipt of one or more specified headers sent from the client to the backend service.
  * Prevents inclusion of one or more specified headers in a response from the backend service to the client.


## Applying the Header Removal Policy
Perform the following steps to apply the policy:
  1. From your left navigation, select **API Administration**.
  2. Select the version to which you want to apply the policy.
  3. From your left navigation, select **Policies**.
The policies details page appears. If the header was already provided by the client or another policy, the value is overwritten with your header.
  4. Click **Apply New Policy**.
The Select Policy dialog box appears.
  5. From the policy list, select the **Header Removal** radio button and click **Configure Policy**.
The Apply Header Removal policy page appears.
  6. In the Inbound Header Map box, type the name of the inbound header.
For example, type `in-header` in the box.
  7. In the Outbound Header Map box, type the name of the outbound header.
For example, type `out-header` in the box.
  8. Click **Apply**.
The Policies page is displayed with the Header Removal policy that you added.
Storage Event Processors | MuleSoft Documentation
# Storage Event Processors
Anypoint Code Builder 
Anypoint Studio 
The Storage processors allows you to manage temporary storage during your tests.
All storage is cleared as soon as the test ends.
## Store operation
Stores the given data associated with the given key. If `value` not set, it defaults to the `payload`.
```
<munit-tools:store key="myKey">
  <munit-tools:value>#[person : { name: 'John', lastName: 'Smith' }]</munit-tools:value>
</munit-tools:store>
```

## Retrieve operation
Retrieves the data associated with the given key
```
<munit-tools:retrieve key="myKey"/>
```

## Remove operation
Removes and returns the data associated with the given key
```
<munit-tools:remove key="myKey"/>
```

## Clear stored data operation
Clears all stored data
```
<munit-tools:clear-stored-data/>
```
View API Instance Contracts | MuleSoft Documentation
# View API Instance Contracts
From API Manager, you can view the contracts created for your API instance when you grant access to that instance.
To view your API instance contracts:
  1. Navigate to **Anypoint Platform** > **API Manager**.
  2. In **API Administration** , click the name of the API instance you want to configure.
  3. Click **Contracts**. A tab displays the contract information for your API instance.


## See Also
  * Requesting Access to API Instances from Exchange
  * Removing API Instance Contracts
  * Obtaining Client ID and Client Secret Credentials of a Client Application
MuleSoft Government Cloud Release Notes | MuleSoft Documentation
# MuleSoft Government Cloud Release Notes
These release notes describe updates to MuleSoft Government Cloud as from January 10, 2024.
## April 8, 2025
### What’s New
  * MuleSoft Government Cloud now supports Mule runtime engine version 4.9.3.


## May 8, 2024
### What’s New
  * MuleSoft Government Cloud now supports Java 17.
For more information, visit Java Support.


## March 12, 2024
### What’s New
  * MuleSoft Government Cloud now supports Mule runtime engine version 4.6.
The March CloudHub 1.0 release introduces patches for Runtime versions 4.3.0 and 4.4.0 and Runtime 4.6. This update is a breaking change as it enforces compliance with FIPS 140-2 on runtime versions 4.6, 4.4, and 4.3 for CloudHub applications within the MuleSoft Government Cloud.
For more details about the impact of this update, check the following Knowledge Base articles:
    * GovCloud - March 2024 - Updates on FIPS Enforcement.
    * GovCloud - March 2024 DLB Upgrade.


## January 10, 2024
### What’s New
  * Trusted domains allowlisting is now available in MuleSoft Government Cloud.
For more information, visit Allowing Trusted Domains for API Platform Proxies.
Microsoft Dynamics 365 for Finance and Operations Connector 3.0 | MuleSoft Documentation
# Microsoft Dynamics 365 for Finance and Operations Connector 3.0
Anypoint Connector for Microsoft Dynamics 365 for Finance and Operations (Microsoft Dynamics 365 for Finance and Operations Connector) enables integration with Microsoft Dynamics 365 for Operations Web API.
## Before You Begin
To use this connector, you must be familiar with:
  * The Microsoft Dynamics 365 for Finance and Operations API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements in a Mule flow
  * Global elements
  * How to create a Mule app using Anypoint Studio


Before creating an app, you must have access to a Microsoft Dynamics 365 instance (online or on-premises) managed by Azure Active Directory.
## Common Use Cases for the Connector
This connector enables you to perform these operations:
  * Authorize or unauthorize access to a Microsoft Dynamics 365 for Finance and Operations server
  * Create a recurring job on Microsoft Dynamics 365 for Finance and Operations server
  * Retrieve multiple entries, including retrieval using DataSense Query Language
  * Execute operations


See Examples for use cases.
## Audience
  * New users, read:
    * Using Anypoint Studio to Configure the Connector to create your Mule app
  * Examples, which provides an example use case for the connector
  * Advanced users, read:
    *   * The Examples, which provide one or more use cases for the connector


## Authentication Types
Microsoft Dynamics 365 for Finance and Operations Connector uses the OAuth 2.0 authentication connection type, which delegates user authentication to the service hosting the user account.
## Next Step
After you complete the prerequisites and experiment with templates and examples, you are ready to create an app and configure the connector using Anypoint Studio.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * Microsoft Dynamics 365 for Finance and Operations Connector Reference
  * MuleSoft Help Center
mask | MuleSoft Documentation
# mask
## mask(value: Null, fieldName: String | Number | PathElement): (newValueProvider: (oldValue: Any, path: Path) -> Any) -> Null
Helper function that enables `mask` to work with a `null` value.
_Introduced in DataWeave version 2.2.2._
## mask(value: Any, selector: PathElement): (newValueProvider: (oldValue: Any, path: Path) -> Any) -> Any
This `mask` function replaces all _simple_ elements that match the specified criteria.
Simple elements do not have child elements and cannot be objects or arrays.
_Introduced in DataWeave version 2.2.2._
### Parameters
Name | Description  
---|---  
A value to use for masking. The value can be any DataWeave type.  
The `PathElement` selector.  
### Example
This example shows how to mask the value of a `password` field in an array of objects. It uses `field("password")` to return the `PathElement` that it passes to `mask`. It uses **to specify the value (**) to use for masking.
#### Source
```
%dw 2.0
output application/json
import * from dw::util::Values
---
[{name: "Peter Parker", password: "spiderman"}, {name: "Bruce Wayne", password: "batman"}] mask field("password") with "*****"
```

#### Output
```
[
  {
   "name": "Peter Parker",
   "password": "*****"
  },
  {
   "name": "Bruce Wayne",
   "password": "*****"
  }
 ]
```

## mask(value: Any, fieldName: String): (newValueProvider: (oldValue: Any, path: Path) -> Any) -> Any
This `mask` function selects a field by its name.
_Introduced in DataWeave version 2.2.2._
### Parameters
Name | Description  
---|---  
The value to use for masking. The value can be any DataWeave type.  
`fieldName` | A string that specifies the name of the field to mask.  
### Example
This example shows how to perform masking using the name of a field in the input. It modifies the values of all fields with that value.
#### Source
```
%dw 2.0
output application/json
import * from dw::util::Values
---
[{name: "Peter Parker", password: "spiderman"}, {name: "Bruce Wayne", password: "batman"}] mask "password" with "*****"
```

#### Output
```
[
  {
   "name": "Peter Parker",
   "password": "*****"
  },
  {
   "name": "Bruce Wayne",
   "password": "*****"
  }
 ]
```

## mask(value: Any, i: Number): (newValueProvider: (oldValue: Any, path: Path) -> Any) -> Any
This `mask` function selects an element from array by its index.
_Introduced in DataWeave version 2.2.2._
### Parameters
Name | Description  
---|---  
The value to mask. The value can be any DataWeave type.  
The index to mask. The index must be a number.  
### Example
This example shows how `mask` acts on all elements in the nested arrays. It changes the value of each element at index `1` to `false`.
#### Source
```
%dw 2.0
output application/json
import * from dw::util::Values
---
[[123, true], [456, true]] mask 1 with false
```

#### Output
```
[
  [
   123,
   false
  ],
  [
   456,
   false
  ]
 ]
```
toArray | MuleSoft Documentation
# toArray
## toArray(@StreamCapable text: String): Array<String>
Splits a `String` value into an `Array` of characters.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
The `String` value to transform into an `Array` of characters (a `Array<String>` type).  
### Example
This example shows how `toArray` behaves with different inputs.
#### Source
```
%dw 2.0
import * from dw::util::Coercions
output application/json indent=false
---
{
 a: toArray(""),
 b: toArray("hola")
}
```

#### Output
```
{"a": [],"b": ["h","o","l","a"]}
```
Preview the Output of a Transformation (Anypoint Studio) | MuleSoft Documentation
# Preview the Output of a Transformation (Anypoint Studio)
You can provide sample input data to your Transform Message component to see how the transformation affects it. You don’t need to deploy your project to use this feature. A sample output is updated in real time as you make changes both to the sample input and the transformation.
  1. Click on the root of the input pane and select **Edit Sample Data**.
A new tab opens with an empty scaffolding of your input structure. Values are populated with the string `????` as a placeholder.
When the input is of type POJO, samples must be written in DataWeave format. This is not a transformation in itself, just a way to express how data is structured.   
---  
  2. Replace placeholder values with sample values to see how they are mapped out to the preview pane.
To reset the sample to the original scaffolding with placeholders, click the **rescaffold button** . Note that any sample data you provided is lost.   
---  
  3. Enable the preview pane by clicking on the **Preview** button on the top-right of the editor.
As you make changes in the DataWeave code or your sample data, notice how the output data structure changes.
If your transformer has multiple outputs (for example, to both the payload and a variable), the **Preview** pane displays the one corresponding to the currently selected transformation.   
---  
  4. Test your transformation for any special characters or structures that might arrive, verify that the output is what you expected.
Note that samples defined in this pane work only within the **Transform Message** component, they don’t alter the metadata that’s propagated to other components in the flow, and their values aren’t propagated onwards. They aren’t used in your running application as default values nor in any other way.   
---  


## See Also
Workflow: Create a Mapping
Transform Message Component
DataWeave Language
Configuring Flex Gateway in Connected Mode | MuleSoft Documentation
# Configuring Flex Gateway in Connected Mode
  * Configure Replicas - Anypoint Flex Gateway enables you to create replicas, which are instances of Flex Gateway. By default, Flex Gateway runs as a single replica. Running multiple replicas enables scaling, load balancing, and high availability.
  * Configure TLS Context - Flex Gateway enables you to configure a TLS context to support regular TLS and mTLS in both inbound and outbound directions.
  * Configure Shared Storage - Flex Gateway enables you to configure shared storage for distributed caching and rate limiting policies.
  * Configure a Forward Proxy - Flex Gateway enables you to configure a forward proxy to route external HTTP connections through a proxy connection.
  * Configure with the API Manager API Tool - Flex Gateway enables you to configure and manage Flex Gateway via the API Manager API tool, a command-line tool used to communicate with API Manager.
  * Configure a Liveness Check - Flex Gateway enables you to run a liveness check command to test gateway health. Additionally, Flex Gateways deployed on Kubernetes include a liveness probe to automatically restart pods after a specified number of failed checks.
  * Configure PROXY Protocol - Flex Gateway supports PROXY protocol to perserve client IP address when servicing multi-layer connections.
  * Automate Flex Gateway with a Jenkins Pipeline using Anypoint CLI - Flex Gateway enables you to build a Jenkins Pipeline by using Anypoint CLI to automate workflows.
  * Automate Flex Gateway with a Jenkins Pipeline using the API Manager API - Flex Gateway enables you to build a Jenkins Pipeline by using the API Manager API to automate workflows.
  * Configure Distributed Tracing - Flex Gateway enables you to configure distributed tracing for your APIs.
URL Types (dw::core::URL) | MuleSoft Documentation
# URL Types (dw::core::URL)
Type | Definition | Description  
---|---|---  
`type URI = { isValid: Boolean, host?: String, authority?: String, fragment?: String, path?: String, port?: Number, query?: String, scheme?: String, user?: String, isAbsolute?: Boolean, isOpaque?: Boolean }` |  Describes the URI type. For descriptions of the fields, see URL Types (dw::core::URL).
Getting the Bearer Token for a Connected App Example | MuleSoft Documentation
# Getting the Bearer Token for a Connected App Example
This example demonstrates how to create a connected app that acts on its own behalf using client credentials to get the bearer token so you can invoke Anypoint Platform APIs.
## Create a Connected App
To create a connected app, add Runtime Manager scopes, and deploy the app to CloudHub:
  1. In the Access Management navigation menu, click **Connected Apps**.
  2. In **Owned Apps** , click **Create App**.
  3. In **Create App** , enter a unique name for the app, select **App acts on its own behalf (client credentials)** , and then click **Save**.
  4. Click **Add Scopes**.
  5. Select the scopes for the app from the **Runtime Manager** section, and then click **Next**.
For information about scopes and permissions for connected apps, see the Endpoint Scopes.
  6. Select the **Business Groups** the app has permission to access the assigned scopes in and click **Next**.
  7. Select the **Environments** for the business groups and scopes you selected, and click **Next**.
  8. Review the scopes you added and click **Add Scopes**.
  9. In **Update App** , click **Save Changes**.


## Get the bearer token
To get the bearer token for the app:
  1. In the Access Management navigation menu, click **Connected Apps**.
  2. In **Owned Apps** , click **Copy Id** and save the app’s client ID in a secure location.
  3. Repeat the previous step to copy the app’s client secret.
  4. Run the following cURL command and replace `CLIENT_ID` and `CLIENT_SECRET` with your client ID and secret:
```
curl --location --request POST https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<CLIENT_ID>' \
--data-urlencode 'client_secret=<CLIENT_SECRET>' \
--data-urlencode 'grant_type=client_credentials'
```

You receive the following response:
```
{
  "access_token": "<bearer token>",
  "token_type": "bearer"
}
```

Now that you have the bearer token, you can use the connected app to invoke Anypoint Platform APIs. For more examples, see Connected App Examples.


## See Also
  * Connected Apps for Developers
Map Network Drive | MuleSoft Documentation
# Map Network Drive
This action step lets you map and unmap any network location and any drive letter.
## Properties
**Drive** The drive letter to map the network location to. Or, if you selected _Unmap Drive_ , the drive letter to unmap.
**Login required** Activate if the network location is password protected.
**Network Path** The path of the network location you want to map.
**Password** The password required to access the network location. Only applicable if _Login required_ is selected.
**Unmap drive** Select this if you want to unmap a drive instead of mapping it.
**Username** The username required to access the network location. Only applicable if _Login required_ is activated.
**Warning if already mapped** Normally, an error is thrown if you try to map a drive that is already mapped. Activate this if you only want a warning instead.
## Inbound Variable
**Network Path** The path of the network location you want to map.
## Outbound Variables
The action step _Map Network Drive_ possesses no outbound variables.
Box Connector 5.2 | MuleSoft Documentation
# Box Connector 5.2
Box is an online file sharing and content management service for businesses. Anypoint Connector for Box (Box Connector) is a RAML-based connector that provides synchronization of data and automation of processes between Box and third party CRMs, CMS, mobile, and social applications. Because this is a RAML-based connector, it only uses REST calls to interact with the Box 2.0 API and supports only a subset of available API services.
## Before You Begin
Before creating an app, you must have access to the Box target resource and Anypoint Platform. You must also understand how to create a Mule app using Anypoint Studio.
You should be familiar with the use of the Box 2.0 API, Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and global elements.
To use this connector you need the following:
  * A developer account or other valid Box instance.
  * MuleSoft Enterprise License and necessary entitlements.


## Connection Types
Box Connector uses the following authentication types:
  * JWT Server-side authentication using a keypair. For more information about configuring Box Connector with JWT, refer to JWT Authentication.
  * Oauth2security Access tokens provided by the authorization server.


## Next Step
After you complete the prerequisites, you are ready to create an app with Anypoint Studio.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * Box Connector on Exchange
  * MuleSoft Help Center
Grant Permission to Access an Environment | MuleSoft Documentation
# Grant Permission to Access an Environment
To be able to fully access API Manager operations within an environment, users must have the API Manager Environment Administrator permission. An API Manager Environment Administrator role is associated with tasks performed only in API Manager. You can change permissions for API Manager-related operations from Anypoint Access Management.
Regarding roles, note that:
  * Roles and permissions assigned to a user in one particular business group are independent of the roles and permissions assigned to that same user in other business groups.
  * Roles are business group-specific, so ensure that you are in the correct business group for which to manage roles by clicking the menu next to your user icon.


The following diagram illustrates the tasks enabled by having each permission:
In this diagram, note that an Environment Administrator has access to all the functionalities and permissions. Outer permissions provide permission to the inner permissions. For example, `Manage Alerts` gives permission to View Alerts and to View API Configuration.
API Manager supports the following additional environment-level permissions:
Permission | Description | Notes  
---|---|---  
Deploy API Proxies |  Deploy or redeploy an API proxy |  Requires Runtime Manager and Hybrid access. This role enables deployment access from API Manager, but cannot guarantee that deployment is successful due to its dependency on Runtime Manager or Hybrid.  
Manage Alerts |  Create, edit, and delete alerts.  
Manage APIs Configuration |  Import APIs from Exchange |  This permission also enables a user to promote an API to another environment, edit the configuration of an API, and delete APIs. |  This permission is per environment. API visibility cannot be restricted to specific users inside your organization.  
---  
Manage Contracts |  Deploy, reject, and revoke contracts |  This permission also gives the user permission over tiers.  
Manage Policies |  Create, edit, delete, enable, disable, and reorder a policy  
View Alerts |  List alerts and view configuration summary of an alert  
View APIs Configuration |  List and view APIs |  List APIs, view configuration summary of an API, and download proxies. |  This permission is per environment. API visibility cannot be restricted to specific users inside your organization.  
---  
View Contracts |  List contracts and their configuration |  Can also list SLA tiers and their configuration.  
View Policies |  View a listing of policies and view the configuration of a policy  
## Grant Permissions
To grant environment permissions to roles from API Manager:
  1. **Click Access Management** > **Users** > **_a user to give permissions_** > **API Manager** > Permissions.
  2. Select the permissions for the user and click to save the permissions:


The following API Manager 1.x roles are incompatible with API Manager 2.x:
  * API Versions Owner
  * API Creator
  * Portals Viewer

  
---  
## See Also
  * Promote an API instance to another Environment
Configure Default Events Tracking | MuleSoft Documentation
# Configure Default Events Tracking
Because event tracking requires processing and network overhead to aggregate and store the events that Mule runtime engine generates, it is disabled by default. However, you can enable and configure default events tracking for connectors or message processors that support it, at one of two levels:
  * At the flow level
  * At the message processor (connector or component) level, which takes precedence over the flow-level setting


After you enable event tracking, customize the transaction ID to identify specific tracked events so that you can analyze them at runtime.
## Flow-Level Event Tracking
Use this option in the Flow component to enable default event tracking for all elements in a flow that support event tracking. You can disable tracking for specific processors or connectors to override the flow level setting.
Steps to enable default events tracking for all components in a flow:
  1. Select your flow component to open the properties view.
  2. Enable default business events using either the UI or XML:
     * In the UI, select **Enable default events tracking** :
     * In the XML, add attribute `tracking:enable-default-events="true"` to the `flow` element:
```
<flow name="testFlow" tracking:enable-default-events="true">
```

  3. Save your settings.


## Message Processor-Level Event Tracking
You can enable event tracking on individual connectors and Mule components that support event tracking.
The following Mule components provide a configuration for enabling business events:
  * Choice router
  * Round Robin router
  * First Successful router


Steps to enable default events tracking for an individual component:
  1. Open the connector or component properties view.
  2. Enable default business events using any of the following options:
     * In the UI, select **Enable default events tracking** :
     * In the XML, add attribute `tracking:enable-default-events="true"` inside your component element:
```
<flow name="flow">
 ...
  <choice doc:name="Choice" tracking:enable-default-events="true"/>
 ...
</flow>
```

  3. Save your settings.


## Customize the Transaction ID
The Set Transaction Id component enables you to set an identifier for all tracked events so that meaningful information, such as an order number, is displayed for a transaction when analyzing tracked events at runtime, whether using Anypoint Runtime Manager or CloudHub.
The transaction ID supports DataWeave expressions, which enables you to create an ID dynamically and include information related to the event into the ID.
Follow these steps to set a transaction ID either in Anypoint Studio or by editing the configuration XML:
  * In the Studio UI:
    1. Drag the **Set Transaction Id** component to your flow.
    2. In the **Set Transaction ID** configuration screen, set an ID value for the **Transaction ID** field:
  * In the XML editor:
    * Add a child element to the `flow` element:
```
<flow name="flow">
...
 <tracking:transaction id="#[payload.orderId]" />
...
</flow>
```



## See Also
Duplicate a Project | MuleSoft Documentation
# Duplicate a Project
You can duplicate projects in API Designer. You might want to duplicate a project if you need to make extensive changes to the project without losing the original on which the duplicate project is based.
Any dependencies that are listed in the original project are retained in the duplicate project.
## Before You Begin
  * Ensure that the mocking service is not turned on.
  * Ensure that the project is not in read-only mode.


## Procedure
  1. Open the project.
  2. Click the gear icon in the top-right corner of the editor.
  3. Select **Duplicate**.
  4. Name the duplicate project and click **Duplicate**.


## Result
API Designer opens a new browser tab that displays the new project. If the original project is in the text editor, the duplicate project is opened in the text editor. If the original project is in the visual editor, the duplicate project is opened in the visual editor.
If the original was in a sub-branch, the duplicate is on the same sub-branch.
The duplicate project is listed in Design Center’s project list.
Prerequisites for MuleSoft Accelerator for Consumer Goods | MuleSoft Documentation
# Prerequisites for MuleSoft Accelerator for Consumer Goods
This page provides a summary of the guides available for configuring the various systems and products required to implement the use cases provided by this solution. The individual systems needed, and amount of configuration required, depend on which assets are to be deployed in your target environment(s) - refer to the use case pages for more details.
## Available Guides
The following setup and configuration guides are available for this accelerator:
  * SAP S/4HANA Setup Guide


Most of the implementation templates also contain details on requirements specific to those applications.
## See Also
  *   * MuleSoft Accelerator for Consumer Goods
Upgrading Runtime Fabric Using Helm | MuleSoft Documentation
# Upgrading Runtime Fabric Using Helm
You can use Helm to upgrade Anypoint Runtime Fabric on an Amazon Elastic Kubernetes Service (Amazon EKS), Amazon Elastic Kubernetes Service Anywhere (Amazon EKS-A), Azure Kubernetes Service (AKS), or Google Kubernetes Engine (GKE) installation that you manage.
Helm upgrades are not available for existing installations that used the `rtfctl` command line tool.
When you upgrade Runtime Fabric using Helm, Runtime Manager provides the Helm command you need to run the upgrade.
The upgrade command supplied by Runtime Manager uses the same parameters and values you added to the Helm command when you installed Runtime Fabric. If you changed any values after install, such as proxy values, and want to keep those values after the upgrade, you need to add them to the upgrade command before you run the upgrade.  
---  
To upgrade Runtime Fabric Using Helm:
  1. In Runtime Manager, navigate to your Runtime Fabric by selecting it on the Runtime Fabrics tab.
  2. Click **Upgrade…**.
  3. Run the command supplied by Runtime Manager to generate a `values.yml` file based on your existing installation.
  4. Follow the prompts to generate and download the `values.yml` file.
  5. In `values.yml` file, add any optional parameters needed.
Refer to the `values.yml` Reference in the installation documentation for a list of optional and required parameters.
  6. Update your Helm repo to ensure you have the latest Runtime Fabric agent chart:
```
helm repo update
```

  7. To complete the upgrade, run the following command:
```
helm upgrade --install runtime-fabric rtf/rtf-agent --version <VERSION_FROM_UI> -f values.yaml -n <namespace>
```
toDateTime | MuleSoft Documentation
# toDateTime
## toDateTime(str: String, formatters: Array<Formatter>): DateTime
Transforms a `String` value into a `DateTime` 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 `DateTime` value.  
`formatters` | Array<Formatter> | The `array` of formatting to use on the `DateTime` value.  
### Example
This example shows how `toDateTime` 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: toDateTime("2003-10-01 23:57:59Z", [{format: "uuuu/MM/dd HH:mm:ssz"}, {format: "uuuu-MM-dd HH:mm:ssz"}]),
 b: try(() -> toDateTime("2003-10-01 23:57:59Z", [{format: "uuuu/MM/dd HH:mm:ssz"}])).error.message
}
```

#### Output
```
{
 a: |2003-10-01T23:57:59Z| as DateTime {format: "uuuu-MM-dd HH:mm:ssz"},
 b: "Could not find a valid formatter for '2003-10-01 23:57:59Z'"
}
```

## toDateTime(number: Number, unit: MillisOrSecs | Null = null): DateTime
Transforms a `Number` value into a `DateTime` value using `milliseconds` or `seconds` as the unit.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
The `Number` value to transform into a `DateTime` value.  
The unit to use for the conversion: `"milliseconds"` or `"seconds"`. A `null` value for the `unit` field defaults to `"seconds"`.  
### Example
This example shows how `toDateTime` behaves with different inputs. It produces output in the `application/dw` format.
#### Source
```
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
  fromEpoch: toDateTime(1443743879),
  fromMillis: toDateTime(1443743879000, "milliseconds")
}
```

#### Output
```
{
 fromEpoch: |2015-10-01T23:57:59Z|,
 fromMillis: |2015-10-01T23:57:59Z| as DateTime {unit: "milliseconds"}
}
```

## toDateTime(str: String, format: String | Null = null, locale: String | Null = null): DateTime
Transforms a `String` value into a `DateTime` value and accepts a format and locale.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
The `String` value to transform into a `DateTime` value.  
The formatting to use on the `DateTime` value. A `null` value has no effect on the `DateTime` value. This parameter accepts Java character patterns based on ISO-8601. A `DateTime` value, such as `2011-12-03T10:15:30.000000+01:00`, has the format `uuuu-MM-dd HH:mm:ssz`.  
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 `toDateTime` 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: toDateTime("2015-10-01T23:57:59Z"),
  b: toDateTime("2003-10-01 23:57:59Z","uuuu-MM-dd HH:mm:ssz")
}
```

#### Output
```
{
 a: |2015-10-01T23:57:59Z|,
 b: |2003-10-01T23:57:59Z| as DateTime {format: "uuuu-MM-dd HH:mm:ssz"}
}
```
Error When Creating a New Community from a Template | MuleSoft Documentation
# Error When Creating a New Community from a Template
If creating a new community from a template shows the error `An unexpected error occurred,Try again or contact your Salesforce administrator for help`, compile all Apex classes: open **Setup** > **Custom Code** > **Apex Classes** and click **Compile all classes**. In a few minutes, the page displays the message `Compilation Complete: Compilation Successful`.
Find more information about compiling Apex classes in the Salesforce help article Manage Apex Classes.
time | MuleSoft Documentation
# time
## time<T>(valueToMeasure: () -> T): TimeMeasurement<T>
Executes the input function and returns a `TimeMeasurement` object that contains the start and end time for the execution of that function, as well the result of the function.
### Parameters
Name | Description  
---|---  
`valueToMeasure` | A function to pass to `time`.  
### Example
This example passes `wait` and `sum` functions (defined in the header), which return their results in `TimeMeasurement` objects.
```
%dw 2.0
output application/json
fun myFunction() = dw::Runtime::wait("My result",100)
fun myFunction2() = sum([1,2,3,4])
---
{ testing: [
  dw::util::Timer::time(() -> myFunction()),
  dw::util::Timer::time(() -> myFunction2())
 ]
}
```

#### Output
```
{
 "testing": [
  {
   "start": "2018-10-05T19:23:01.49Z",
   "result": "My result",
   "end": "2018-10-05T19:23:01.591Z"
  },
  {
   "start": "2018-10-05T19:23:01.591Z",
   "result": 10,
   "end": "2018-10-05T19:23:01.591Z"
  }
 ]
}
```
Extract Payload Information to Variables | MuleSoft Documentation
# Extract Payload Information to Variables
Cloud IDE 
Desktop IDE 
**Open Beta Release** : The **cloud IDE is in open beta**. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.
This section of the tutorial teaches you how to extract information from the payload into different variables to refer to those values later in the flow.
## Before You Begin
Complete these procedures:
  * Integrate Salesforce Data into Slack and Email Notifications.
  * Create a Configuration File for Slack and Salesforce.
  * Configure your Salesforce integration.


## Extract Values From the Payload
  1. In Anypoint Code Builder, open your `new-case-salesforce.xml` file.
  2. Click the (**Add component**) icon after the **On New Case** Salesforce component:
  3. Type `Transform` and select **Transform**.
  4. Configure the Transform Message component to extract data from the payload to variables:
```
<ee:transform doc:name="Extract Values from Case" >
  <ee:variables>
   <ee:set-variable variableName="casestatus"> **(1)**
     <![CDATA[%dw 2.0 output application/java --- payload.Status]]>
   </ee:set-variable>
   <ee:set-variable variableName="casenumber"> **(2)**
     <![CDATA[%dw 2.0 output application/java --- payload.CaseNumber]]>
   </ee:set-variable>
<ee:set-variable variableName="slackchannel"> **(3)**
     <![CDATA["this-is-a-test"]]>
   </ee:set-variable>
  </ee:variables>
 </ee:transform>
```

`casestatus` retrieves the Salesforce case status: **New** , **Working** , or **Escalated**.  
---  
`casenumber` retrieves the case number created by Salesforce.  
Set the `slackchannel` to the channel name that you set earlier in the tutorial.  


## Concatenate Your Values in The Payload
Add a Set Payload component to concatenate the value of your variables in the resulting payload of your application:
  1. Click the (**Add component**) icon after the Transform Message component:
  2. Type `set` and select **Set Payload**.
  3. Configure the Set Payload component with the following code:
```
<set-payload doc:name="Set Case Info" value='#["Case Number: " ++ (payload.CaseNumber default "") ++ ", Origin: " ++ (payload.Origin default "") ++ ", Case Type: " ++ (payload.Type default "") ++ ", Priority: " ++ (payload.Priority default "") ++ ", Status: " ++ (payload.Status default "")]'/>
```

  4. Proceed to Add a Condition to Your Flow Logic to create a condition to send an email if the case is escalated or otherwise inform about the case in a Slack channel.
Enable a Resource Level Support for a Custom Policy | MuleSoft Documentation
# Enable a Resource Level Support for a Custom Policy
To enable a resource level support for your custom policy you need to add some YAML and XML code to existing custom policy configuration and definition files, respectively, to support resource level policies in Mule 3.8.1 and later.
  1. In the XML definition file, change the standard pointcut definition as follows:
```
<pointcut>
 <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
</pointcut>
```

```
{{#pointcutData.length}}
 {{#pointcutData}}
  <pointcut>
   <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
   <resource methodRegex="{{methodRegex}}" uriTemplateRegex="{{uriTemplateRegex}}"/>
  </pointcut>
 {{/pointcutData}}
{{/pointcutData.length}}
{{^pointcutData.length}}
 <pointcut>
  <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
 </pointcut>
{{/pointcutData.length}}
```

  2. Add the following key/value pair to the YAML file:
`resourceLevelSupported: true`
  3. In Anypoint Platform, click API Manager.
  4. In API Administration, choose Custom policies.
  5. Click Add Custom Policy.
  6. In Add Custom Policy, give the new policy a name, for example myResourceLevelPolicy.
  7. Browse to and select the YAML and XML files you created or downloaded.


## See Also
  *   * Creating a Custom Policy
toLocalDateTime | MuleSoft Documentation
# toLocalDateTime
## toLocalDateTime(str: String, formatters: Array<Formatter>): LocalDateTime
Transforms a `String` value into a `LocalDateTime` 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 `LocalDateTime` value.  
`formatters` | Array<Formatter> | The `array` of formatting to use on the `LocalDateTime` value.  
### Example
This example shows how `toLocalDateTime` 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: toLocalDateTime("2003-10-01 23:57:59", [{format: "uuuu/MM/dd HH:mm:ss"}, {format: "uuuu-MM-dd HH:mm:ss"}]),
 b: try(() -> toLocalDateTime("2003-10-01 23:57:59", [{format: "uuuu/MM/dd HH:mm:ss"}])).error.message
}
```

#### Output
```
{
 a: |2003-10-01T23:57:59| as LocalDateTime {format: "uuuu-MM-dd HH:mm:ss"},
 b: "Could not find a valid formatter for '2003-10-01 23:57:59'"
}
```

## toLocalDateTime(str: String, format: String | Null = null, locale: String | Null = null): LocalDateTime
Transforms a `String` value into a `LocalDateTime` value and accepts a format and locale.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
The `String` value to transform into a `LocalDateTime` value.  
The formatting to use on the `LocalDateTime` value. A `null` value has no effect on the `LocalDateTime` value. This parameter accepts Java character patterns based on ISO-8601. A `LocalDateTime` value, such as `2011-12-03T10:15:30.000000` has the format `uuuu-MM-dd HH:mm:ss`.  
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 `toLocalDateTime` 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: toLocalDateTime("2015-10-01T23:57:59"),
 b: toLocalDateTime("2003-10-01 23:57:59","uuuu-MM-dd HH:mm:ss")
}
```

#### Output
```
{
 a: |2015-10-01T23:57:59|,
 b: |2003-10-01T23:57:59| as LocalDateTime {format: "uuuu-MM-dd HH:mm:ss"}
}
```
Apache Cassandra Connector 4.0 | MuleSoft Documentation
# Apache Cassandra Connector 4.0
Anypoint Connector for Apache Cassandra (Apache Cassandra Connector) creates connectivity between Apache Cassandra databases and third-party applications, systems, services such as SAP, PeopleSoft, or Workday, as well as other databases across the enterprise.
Apache Cassandra is an open source distributed NoSQL database intended to manage large amounts of product, customer, and employee data, which implements the DataStax Java Driver for Apache Cassandra 3.10.1.
## Before You Begin
To use this connector, you must be familiar with:
  * The Apache Cassandra 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 Apache Cassandra target resource
  * Anypoint Studio version 4.1.1 or later
  * Mule Enterprise Edition and the entitlements necessary to use this software


## Next
Now that you’ve started, try using Anypoint Studio to configure the Cassandra connector.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * MuleSoft Help Center
Anypoint Custom Metrics Connector Reference | MuleSoft Documentation
# Anypoint Custom Metrics Connector Reference
Anypoint Custom Metrics Connector v2.2.0
This is the main class of the extension and provides the entry point from which configurations, connection providers, operations, and sources can be declared.
## Configurations
### Config
Default configuration. 
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
The name for this configuration. Connectors reference the configuration with this name.  
## Operations
### Send Custom Metric
`<custom-metrics:send>`
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
Metric Name  
Enter contextual information: |  Array of Dimension  
Enter measurements: |  Array of Fact  
Throw runtime exception on validation failure  
#### Throws
  * CUSTOM-METRICS:INVALID_PARAMETER


## Types
The values for `Dimension Name` and `Fact Name` cannot contain spaces.
### Dimension
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Dimension Name  
Collapsible  
### Fact
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
## See Also
  * Anypoint Custom Metrics Connector in Anypoint Exchange
Troubleshooting Linux Services | MuleSoft Documentation
# Troubleshooting Linux Services
The following topics provide possible causes for service issues and describe how to troubleshoot:
  * Flex Gateway Service Failed to Run
  * Other Services Failed to Run


## Flex Gateway Service Failed to Run
The `flex-gateway.service` status displays `failed` after running the `systemctl list-units flex-gateway*` command.
### Diagnose
To diagnose the service failure, run the following command:
```
journalctl -u flex-gateway
```

#### Error 1: “Panic: could not read platform configuration”
If the output of the `journalctl` command includes this line:
```
flex-agent[3253]: panic: could not read platform configuration: open : no such file or directory
```

The problem can be resolved by running `chmod` on the files created during registration.
## Other Services Failed to Run
If your error does not appear, attempt to restart Flex Gateway:
```
sudo ldconfig
sudo systemctl restart flex-gateway
```
Troubleshooting Microsoft Dynamics 365 Connector 2.6 | MuleSoft Documentation
# Troubleshooting Microsoft Dynamics 365 Connector 2.6
To troubleshoot Anypoint Connector for Microsoft Dynamics 365 (Microsoft Dynamics 365 Connector), become familiar with the information about interpreting commonly thrown exception messages.
## Enable Verbose Exception Logging
Enable verbose exception logs to show a complete stack trace of the error instead of the default truncated output:
  1. In Studio, right-click on the project and select **Run > Run Configurations**.
  2. Go to the **Arguments** tab and append the arguments in the **VM arguments** section to add the `mule.verbose.exceptions` property. For example:
`-XX:PermSize=128M -XX:MaxPermSize=256M -Dmule.verbose.exceptions=true`


## Enable Verbose Logging
To get a better understanding of why an application’s interaction with Microsoft Dynamics 365 Connector is failing, temporarily enable verbose logging for the connector.
Remember to always disable enhanced verbosity after troubleshooting, because it can affect your Mule application’s 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` 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.microsoftdynamics365" 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 Commonly Thrown Exceptions
Here is a list of commonly thrown exception messages and how to interpret them:
  * DYNAMICS:CONNECTIVITY
```
Either a connection could not be established or there is a connectivity error.
```

  * DYNAMICS:INVALID_PAGE_SIZE
```
The page size is invalid, for example, if the fetch size value exceeds 5000.
```

  * DYNAMICS:NOT_FOUND
```
The server could not find the requested resource.
```

  * DYNAMICS:OPERATION_FAILED
```
The operation fails, for example, if the protocol or entity attributes are invalid or if invocation fails.
```

  * DYNAMICS:PARSE_ERROR
```
There is an error when parsing a JSON entity, for example, the entity ID is invalid or the encoding for the provided JSON is invalid.
```

  * DYNAMICS:RETRY_EXHAUSTED
```
The consumer is not subscribed to any topics, and no manually assigned partitions are set to consume from.
```

  * DYNAMICS:TIMEOUT
```
A specific request takes longer than the configuration timeout values.
```

  * DYNAMICS:UNAUTHORIZED
```
There is an unauthorized request.
```

  * DYNAMICS:UNKNOWN
```
There is an unknown or an unexpected error.
```



## See Also
  * Introduction to Anypoint Connectors
  * Microsoft Dynamics 365 Connector Reference
  * MuleSoft Help Center
  *