--- alias: user-guide-business-workflow-task-map-collection render_macros: false description: "Projects supplied entities or records into fresh scalar-valued records without changing source objects." --- # Map Collection Fields Projects supplied entities or records into fresh scalar-valued records without changing source objects. ![Screenshot of a Business Workflow projecting Material fields with a supplied mapping collection.](images/business-workflow-task-map-collection.png) ## Inputs Set `Collection`, `Mappings` in the task details. Use the value editor to select compatible results from earlier tasks. `Mappings` accepts a collection of `Cmf.Foundation.BusinessObjects.Tasks.MapCollectionTask.FieldMapping` objects. Enter a C# expression enclosed in `{{ ... }}` directly in this input, or reference an earlier output containing that type. | Property | Description | | --- | --- | | `Name` | Required output field name. Names must be unique, ignoring case. | | `Source` | Dot-separated field path relative to the current item. Leave it unset to use `Value`. | | `Value` | Scalar constant or earlier result to use when `Source` is unset. | | `ValueType` | Logical scalar type, such as `String` or `Decimal`. The default, `Object`, preserves the scalar's type. | | `DefaultValue` | Fallback for a missing source path. A present null value remains null. | Table 1: Field mapping properties ## Outputs Use `Rows`, `RowCount` in subsequent tasks. ??? example "Project Material Names and Quantities" Use a preceding [Load or Refresh Entities](../entities/business-workflow-task-load-entities.md) task named `load` to load the **Materials** to project. 1. Add **Map Collection Fields** after `load` and name it `map`. 2. Set `Collection` to `{{$load.Result}}`. 3. Enter the following expression in `Mappings`: ```csharp {{new Cmf.Foundation.BusinessObjects.Tasks.MapCollectionTask.FieldMapping[] { new() { Name = "LotName", Source = "Name", ValueType = "String" }, new() { Name = "Quantity", Source = "PrimaryQuantity", ValueType = "Decimal" } }}} ``` 4. Use `{{$map.Rows}}` in a subsequent task, such as **Compose JSON**. Each record contains `LotName` and `Quantity`; the original **Materials** remain unchanged. ## Behavior Connect a compatible collection of field mappings to `Mappings`. The task creates new records and leaves the source collection unchanged. A field mapping identifies its output name, source field or constant value, and value type.