Using Javascript for accessing advanced operations in Pattern DesignerIssue <!-- div.margin{ padding: 10px 40px 5px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing: 8px; border-collapse: separate; } table.internalTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:0; } .sp td{ border-bottom: 1px solid; border-right: 1px solid; border-color:#E0E0E0; background-color: #ffffff; height: 20px; padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; } .sphr td{ border-right: 1px solid; border-bottom: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; height: 20px; } .title { color: #D1232B; font-weight:; font-size:25px; } .hd1{ color: #D1232B; font-weight:; font-size:18px; } .hd2{ color: #646464; font-weight:bold; font-size:16px; } .hd3{ color: #7a7a7a; font-weight:; font-size:16 px; text-decoration:; } .hd4{ color: #000000; font-weight:bold; font-size:14 px; text-decoration:; } --> Using Javascript for accessing advanced operations in Pattern Designer | Optional Overview This article is relevant for the Geneva and later releases. You can create or customize patterns using Pattern Designer. The Pattern Designer user interface allows you to use only predefined operations. However, you can also use Javascript to use advanced operations that are not part of the Pattern Designer UI. Insert Javascript to access predefined context (CTX) objects to run commands, retrieve attributes values, or set attribute values. This feature is available for the Set variable and Transform table operations. Note: Use Javascript in Pattern Designer only if you are an advanced user with programming experience. Execution context methodsThere are several execution methods of the CTX objects in Pattern Designer: getCommandManager(): This method returns a Command Manager object (see details on this object below).getAttribute(name): This method uses the attribute name as its input and returns its value. If the attribute is scalar, it returns an object of String type. If it is a table, it returns a Java object of the List type <Map<String,String>. Each object in the List is a row in the table. Each row is Map<String,String>, where the key is the column name and the value is the field value.setAttribute(name, Object):This method sets an attribute in the context. The first argument is the attribute name. The second can be a String, in case of scalar attribute, or Java object of type List<Map<String,String>>, in case of table attribute.CommandManager.shellCommand: This method executes a command on a target host. On UNIX machines or network devices, this command is using SSH. On Windows machines, it runs commands using the 'cmd'. Arguments: Command: string containing the command to be executedsuperUser: Boolean argument defining if the command needs to be executed with elevated rights like sudoexecutionMode: put null herecommandParams: put null hereexecutionContext: put CTX here Procedure Create a new pattern or select an existing pattern to customize as described in the product documentation.Navigate to the Identification section or Connection section.Add a new step or select a step you want to customize.Select Set Variable from the Operation list.In the Value field, type EVAL(javascript:), and then click the Edit Text button.In the Edit Text window, enter your Javascript code. For example, enter eval(javascript: CTX.getCommandManager().shellCommand("hostname", false, null, null, CTX);) to execute the hostname comment on the target host.Click OK. The Javascript is displayed in the Value field. Enter the relevant entry that in the Parameter field. The parameter displays the value that is retrieved as a result of running the Javascript.Click Save. <!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internaltable { white-space:nowrap; text-align:left; border-width: 1px; border-collapse: collapse; font-size:14px; width: 85%; } table.internaltable th { border-width: 1px; padding: 5px; border-style: solid; border-color: rgb(245, 245, 245); background-color: rgb(245, 245, 245); } table.internaltable td { border-width: 1px; padding: 5px; border-style: solid; border-color: #E0E0E0; color: #000000; } .title { color: #D1232B; font-weight:normal; font-size:28px; } h1{ color: #D1232B; font-weight:normal; font-size:21px; margin-bottom:-5px } h2{ color: #646464; font-weight:bold; font-size:18px; } h3{ color: #000000; font-weight:BOLD; font-size:16px; text-decoration:underline; } h4{ color: #646464; font-weight:BOLD; font-size:15px; text-decoration:; } h5{ color: #000000; font-weight:BOLD; font-size:13px; text-decoration:; } h6{ color: #000000; font-weight:BOLD; font-size:14px; text-decoration:; } -->