{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":29723,"path":"it-operations-management/discovery/r_OnClassificationScriptObjects.md","title":"On classification script objects for Discovery","bundle":null,"doc_type":null,"release":"australia","body":"\n# On classification script objects for Discovery\n\nUse an On classification script in a process classifier to customize an application record.\n\n## Renaming the default application name\n\nBy default, application names are in this format: `<name of the process classifier>@<the name of the computer CI where the process resides>;`\n\nFor example, for a MySQL server running on a computer called machineA, the application is named `mysql@machineA`.\n\nYou can use the **On classification script** field in the [process classifier record](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/discovery/t_CreateAProcessClassification.md) to change the default application name to match your business needs. For example, the following script changes the default application name to include a suffix after the process classifier:\n\n```\nvar computerName = g_sensor.deviceGR.name;\nvar processClassifierName = g_classification.name;\ncurrent.name = processClassifierName + \"999\" + \"@\" + computerName;\n```\n\nIn this example, the name of the application record becomes `mysql999@machineA`.\n\nAnother common technique is to set the application name based on the name, command, and parameter variables. For example, an Eclipse process might have the following values in these variables:\n\n<table id=\"table_kdz_jgv_1q\"><tbody><tr><td>\n\nname\n\n</td><td>\n\n\"eclipse\"\n\n</td></tr><tr><td>\n\ncommand\n\n</td><td>\n\n\"/glide/eclipse/Eclipse.app/Contents/MacOS/eclipse\"\n\n</td></tr><tr><td>\n\nparameter\n\n</td><td>\n\n\"-psn\\_0\\_1884620\"\n\n</td></tr></tbody>\n</table>If an Eclipse application runs on a computer called machineA, ServiceNow names the application eclipse@machineA. The following script appends the parameter value as part of the application name.\n\n```\nvar computerName = g_sensor.deviceGR.name;\nvar processClassifierName = g_classification.name;\ncurrent.name = processClassifierName + parameters + \"@\" + computerName;\n```\n\nIn this example, the name of the application record becomes eclipse-psn\\_0\\_1884620@machineA.\n\nSometimes it is useful to pass values to the triggered probes in the process classification. You can do this by creating a custom script that defines a name/value pair for the `g_probe_parameters` object. For example:\n\n```\ng_probe_parameters['processCommand'] = command;\n```\n\nIn this example, when a classification record triggers a probe, the script passes the probe a parameter called `processCommand` with the value of the `command` variable.\n\n## Script objects\n\nUse these objects in the script:\n\n|Script object|Description|\n|-------------|-----------|\n|current|Points to a JavaScript object with its \\[property:value\\] pair to update the application record. It is not an actual GlideRecord object of the application.|\n|g\\_sensor|Points to the DiscoverySensor object defined in the DiscoverySensor script include. This object contains a deviceGR object, which points to the computer CI record on which the process resides.|\n|g\\_classification|Points to the process classifier record. This object is set in the Application Dependency Mapping sensor and is available in the **On Classification script** field. Use it to access the classified process properties: name, command, parameters, PID, and table name.|\n|name|Points to the process name.|\n|command|Points to the process command.|\n|parameters|Points to the process parameters.|\n|g\\_probe\\_parameters|A JavaScript object that enables parameter passing to the triggered probes.|\n\n**Related topics**  \n\n\n[Create a Discovery process handler](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/discovery/t_CreateAProcessHandler.md)\n\n"}}