{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":46354,"path":"service-exchange/service-bridge-v2-create-transform.md","title":"Create a transform in Service Exchange","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a transform in Service Exchange\n\nAs a provider or a consumer, create a transform in Service Exchange to integrate tasks between connected instances.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nThe following steps describe the transform process for providers. Consumers can navigate to **All** &gt; **Service Exchange Consumer** &gt; **Transforms** and follow the same process.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Service Exchange Provider** &gt; **Administration** &gt; **Transforms**.\n\n2.  Click **New**.\n\n3.  On the form, fill in the fields.\n\n<table id=\"table_r2f_zkw_d5b\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nAuto-generated number for the transform record.\n\n</td></tr><tr><td>\n\nCompany\n\n</td><td>\n\nConsumer name for whom this transform is applicable.\n\n</td></tr><tr><td>\n\nAll Companies\n\n</td><td>\n\nIf this is selected, the transform runs for all companies except those with the same company level transform.\n\n Use this field to create a default transform definition that can be applied to all companies. The All companies field eliminates the need to define a specific transform for each customer account even when they have similar requirements. You can use the default definition to transform specific fields across all companies simultaneously.\n\n The global transform is applied only to companies that match the configuration and do not have a specific transform already defined. If a company specific transform for the same configuration already exists, this will override the global transform.\n\n</td></tr><tr><td>\n\nType\n\n</td><td>\n\n-   **Simple**: Used when the field has a known and stable choice list on each instance. A related list of transform lines is created to match the inbound and outbound values.\n-   **Advanced**: Used for complex criteria that requires a script to determine the new value.\n-   **Virtual Inbound**: Used to transform a virtual inbound field. Requires a script to determine the new value.\n-   **Virtual Outbound**: Used to transform a virtual outbound field. Requires a script to determine the new value.\n\n\n</td></tr><tr><td>\n\nInbound\n\n</td><td>\n\nOption that enables an inbound transformation for this transform. This option is available only if you select the Type as Simple or Advanced.\n\n</td></tr><tr><td>\n\nOutbound\n\n</td><td>\n\nOption that enables an outbound transformation for this transform. This option is available only if you select the Type as Simple or Advanced.\n\n</td></tr><tr><td>\n\nProvider table\n\n</td><td>\n\nOption that designates the provider's task table. For example, Case.\n\n</td></tr><tr><td>\n\nConsumer table\n\n</td><td>\n\nOption that designates the consumer's task table. For example, Incident.\n\n</td></tr><tr><td>\n\nProvider field\n\n</td><td>\n\nOption that designates the provider's field. For example, State. This field is available only if you select the Type as Simple or Advanced.\n\n</td></tr><tr><td>\n\nConsumer field\n\n</td><td>\n\nOption that designates the consumer's field. For example, **State**. This field is available only if you select the Type as Simple or Advanced.\n\n</td></tr><tr><td>\n\nVirtual field\n\n</td><td>\n\nWhen Type field is set to **Virtual Inbound** or **Virtual Outbound**, this field is available to reference the virtual field this transform should populate.\n\n</td></tr></tbody>\n</table>4.  Click **Save**.\n\n5.  Select one of the following:\n\n    1.  **Simple:** Click **New** in the Transform lines related list, and fill in the fields on the form.\n\n        |Field|Description|\n        |-----|-----------|\n        |Provider label|Option that designates the provider's choice label. For example, Open.|\n        |Provider value|Option that designates the provider's choice value. For example, 10.|\n        |Customer label|Option that designates the customer's choice label. For example, Progress.|\n        |Customer value|Option that designates the customer's choice value. For example, 2.|\n\n        **Note:** You can generate transform mappings between provider and consumer tables automatically using the Transform Mapping Assist feature. For more information, see [Automate transforms with ServiceNow Otto for TMT](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/telecom-media-technology/now-assist-tmt-generate-transform-maps.md).\n\n    2.  **Advanced**: Use a script to define the outbound and inbound labels and values as shown in the following example:\n\n        ```\n        output.value=input.value;\n        output.label=input.label;\n        \n        var ci=new GlideRecord('cmdb_ci');\n        \n        if(direction=='inbound'){\n           if(ci.get('correlation_id',input.value)){\n              output.value=ci.sys_id+\";\n              output.label=ci.getDisplayValue();\n              }\n        }\n        if (direction=='outbound'){\n          if(ci.get(input.value)){\n             if(ci.correlation_id){\n                output.value=ci.correlation_id+\";\n                output.label=input.label;\n               }\n            }\n        }\n              \n        \n        ```\n\n    3.  **Virtual Inbound**: Use a script to determine the inbound label and value as shown in the following example:\n\n        ```\n        var inputArr = input.value.split(',');\n        var outputValues = [];\n        var outputLabels = [];\n        for (i in inputArr) {\n            getInstanceID(inputArr[i]);\n        }\n        output.value = outputValues+'';\n        output.label = outputLabels+'';\n        \n        function getInstanceID(name) {\n            var gr = new GlideRecord('cmdb_ci_server');\n            if (gr.get('name', name)) {\n                outputValues.push(gr.sys_id+'');\n                outputLabels.push(name);\n            }\n        }\n        ```\n\n    4.  **Virtual Outbound**: Use a script to determine the outbound label and value as shown in the following example:\n\n        ```\n        /*\n         ** The 'input' object contains the original value and label\n         ** 'direction' contains an 'inbound' or 'outbound' value to determine transform direction\n         ** 'object_data' contains the Remote Task GlideRecord\n         ** It is required to set the variables 'output.value' and 'output.label' with your script.\n         */\n        output.value = 'condev,conprod';\n        output.label = 'condev,conprod';\n        ```\n\n6.  Click **Submit**.\n\n7.  On the transform form, click **Activate**.\n\n\n## Result\n\nA transform record is created on your ServiceNow® instance. Any Remote Task's inbound or outbound fields that match a transform will automatically use them. To learn more, see [Create a remote task definition in Service Exchange for Providers](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/service-exchange/service-bridge-v2-create-remote-tasks-defs.md).\n\n"}}