{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":48488,"path":"servicenow-platform/orchestration/t_CreateAJavaScriptProbeActivity.md","title":"Create a JavaScript Probe activity","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a JavaScript Probe activity\n\nCreate a JavaScript Probe activity to instruct a MID server to execute server-side javascript.\n\n## Before you begin\n\nRole required: activity\\_creator or workflow\\_admin\n\n## About this task\n\nThe JavascriptProbe activity has the same functionality as making ‘Packages’ calls into standard Java libraries. It allows you to have more control over the Java libraries on the MID Server. You can load your own JAR files on the MID Server and have the JavascriptProbe make Package calls into those java files.\n\n## Procedure\n\n1.  Create a [custom activity](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/integrate-applications/create-custom-activities.md).\n\n    This action creates a custom activity using a template.\n\n2.  After setting up [general properties](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/General-Flds-Templates.md) and [creating input variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/CreateInputVariables.md), configure the JavaScript probe activity Execution Command.\n\n<table id=\"choicetable_jlf_3tp_vz\"><tbody><tr><td id=\"d210906e112\">\n\n**[Map the input variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/CreateInputVariables.md)**\n\n</td><td>\n\nUse the variables you created to configure the command that Orchestration executes on the MID server.\n\n</td></tr><tr><td id=\"d210906e128\">\n\n**Script type**\n\n</td><td>\n\nSelect the type of script to include. Available options are:-   Custom JavaScript\n-   MID Server script include\n\n\n</td></tr><tr><td id=\"d210906e146\">\n\n**Script**\n\n</td><td>\n\nCustom JavaScript to run with this probe. **Note:** This field is available when the **Script type** selected is **Custom JavaScript**.\n\n</td></tr><tr><td id=\"d210906e164\">\n\n**MID Server script include**\n\n</td><td>\n\nScript for the MID Server to run with this probe. **Note:** This field is available when the **Script type** selected is **MID Server script include**.\n\n</td></tr><tr><td id=\"d210906e182\">\n\n**Select MID Server by host**\n\n</td><td>\n\nMID Server on which the probe runs.\n\n</td></tr><tr><td id=\"d210906e192\">\n\n**Required MID Server capabilities**\n\n</td><td>\n\nMID Server to use, by capabilities.\n\n</td></tr><tr><td id=\"d210906e201\">\n\n**Parameters**\n\n</td><td>\n\nName-value pairs to pass to the host with this probe. You can create these parameters manually, or drag input variables into the **Parameters** fields and assign a value.\n\n</td></tr></tbody>\n</table>    **Note:** You can map parameter values in a test payload to variables in the **Outputs** tab automatically. See [automap output variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/automap-output-variable-inputs.md).\n\n\n## What to do next\n\nFinish creating your JavaScript probe activity by [creating output variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/t_CreateAnOutputVariable.md), [creating a parsing rule](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/t_CreateAParsingRule.md), or [Conditions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/integrate-applications/conditions.md). Refer to the [create custom activities](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/create-custom-activities.md) topic to know your template options.\n\n**Parent Topic:**[Orchestration custom activity templates](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/c_ActivityDesignerComponents.md)\n\n## JavaScript probe template execution parameters\n\nYou use execution parameters to create the input process script in the **Preprocessing** form of the activity designer.\n\nFor descriptions of the JavaScript Probe command fields, see the table in [Configure the JavaScript Probe execution command](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/t_CreateAJavaScriptProbeActivity.md).\n\n**Note:** You must use the `executionParam.` prefix with all variables in this table.\n\n<table id=\"table_pbn_kh5_cr\"><thead><tr><th>\n\nName\n\n</th><th>\n\nVariable\n\n</th><th>\n\nType\n\n</th><th>\n\nUsage\n\n</th></tr></thead><tbody><tr><td>\n\nScript Type\n\n</td><td>\n\nscript\\_type\n\n</td><td>\n\nEnumerated\n\n</td><td>\n\nType of script to run. The possible types are:-   custom\\_javascript\\_typ\n-   mid\\_script\\_include\\_type\n\n</td></tr><tr><td>\n\nScript\n\n</td><td>\n\nscript\n\n</td><td>\n\nString\n\n</td><td>\n\nScript that runs custom JavaScript when the **script\\_type** is **custom\\_javascript\\_type**.\n\n</td></tr><tr><td>\n\nMid script include\n\n</td><td>\n\nmid\\_script\\_include\n\n</td><td>\n\nReference\n\n</td><td>\n\nThe sys\\_id reference associated with the MID Server script include to call, when the **script\\_type** is **mid\\_script\\_include\\_type**.\n\n</td></tr><tr><td>\n\nSource\n\n</td><td>\n\nsource\n\n</td><td>\n\nString\n\n</td><td>\n\nTarget host on which to run the script.\n\n</td></tr><tr><td>\n\nMidCapabilities\n\n</td><td>\n\nmidCapabilities\n\n</td><td>\n\nString \\(comma separated\\)\n\n</td><td>\n\nList of required MID Server capabilities.\n\n</td></tr><tr><td>\n\nParameters\n\n</td><td>\n\nparameters\n\n</td><td>\n\nArray of JavaScript object\n\n</td><td>\n\nArray of JavaScript objects, expressed with the `executionParam.` prefix. To add more name-value pairs to the **parameters** array, append them to the existing array. Create a JavaScript object with the following syntax, and add it to the `executionParam.parameter` array. This assigns additional parameters to the message:```\nvar newParameter = {\"name\":\"parameterName\",\"value\":\"parameterValue\"};\nexecutionParam.parameters.push(newParameter);\n```\n\n</td></tr><tr><td>\n\nValueCapabilities\n\n</td><td>\n\nvalueCapabilities\n\n</td><td>\n\nArray of hashmap\n\n</td><td>\n\nCapability values used to select the MID Server. For more information, see [MID Server capabilities](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown). If there are additional capabilities that are assigned by value, use this example to customize the MID Server selection:```\nvar valueCapability = {'NEW_MID_CAPABIILTY':'NEW_MID_CAPABILITY_VALUE'};\nexecutionParam.valueCapabilities.push(valueCapability);\n```\n\n</td></tr></tbody>\n</table>## JavaScript probe template post-processing parameters\n\nUse these parameters to create a post-processing script.\n\n|Name|Variable|Type|Usage|\n|----|--------|----|-----|\n|Payload|payload|String|Contains raw payload returned from the JavaScript Probe.|\n|Output|output|String|Contains output data returned from the JavaScript Probe.|\n|EccSysId|eccSysId|String|Contains the reference ID associated with the ECC Queue input message.|\n|Error Messages|errorMessages|String|Contains the error messages returned from the JavaScript probe. If no error messages are returned, this value is null.|\n\n## Configure the JavaScript Probe execution command\n\nUse the input variables you created to configure the command that Orchestration executes on the JavaScript Probe target host.\n\n### Before you begin\n\nCreate the input variables you need in the **Inputs** form before you can advance to the **Execution Command** stage.\n\nRole required: activity\\_creator, admin\n\n**Note:** You can test the JavaScript Probe connection between the MID Server and the target without having to run the acvitity in a workflow context. For details, see [test template outputs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/CreateInputVariables.md).\n\n### Procedure\n\n1.  Drag variables from the list of inputs and drop them into command fields.\n\n    The system formats the variable in the proper syntax for the command.\n\n    \\[Omitted image \"JavaScriptExecutionCommand.png\"\\] Alt text: JavaScript Probe execution command\n\n2.  Complete the fields shown in the table.\n\n<table id=\"table_zmv_v25_cr\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nInput\n\n</td><td>\n\nInput variable builder. [Create input variables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/CreateInputVariables.md) to [map](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/CreateInputVariables.md) to available fields.\n\n</td></tr><tr><td>\n\nScript type\n\n</td><td>\n\nSelect the type of script to include. Available options are:-   Custom JavaScript\n-   MID Server script include\n\n\n</td></tr><tr><td>\n\nScript\n\n</td><td>\n\nCustom JavaScript to run with this probe. This field is available when the **Script type** selected is **Custom JavaScript**.\n\n</td></tr><tr><td>\n\nMID Server script include\n\n</td><td>\n\nScript for the MID Server to run with this probe. This field is available when the **Script type** selected is **MID Server script include**.\n\n</td></tr><tr><td>\n\nSelect MID Server by host\n\n</td><td>\n\nMID Server on which the probe runs.\n\n</td></tr><tr><td>\n\nRequired MID Server capabilities\n\n</td><td>\n\nMID Server to use, by capabilities.\n\n</td></tr><tr><td>\n\nParameters\n\n</td><td>\n\nName-value pairs to pass to the host with this probe. You can create these parameters manually, or drag input variables into the **Parameters** fields and assign a value.\n\n</td></tr></tbody>\n</table>3.  Click **Save**.\n\n4.  Click **Continue** to advance to the **Outputs** stage.\n\n\n"}}