logging in or signing up JavaScript for HP Service Manager Primer msanders747 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 159 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 06, 2012 This Presentation is Public Favorites: 0 Presentation Description HP Service Manager uses JavaScript for tailoring and controlling the workflow. This presentation provides a very basic introduction into how it works and is integrated into the product. For more information visit www.newdaypress.com. Comments Posting comment... Premium member Presentation Transcript New Day Press: New Day Press Presents Mike Sanders 1JavaScript Primer: JavaScript Primer For ServiceCenter and Service Manager 2PowerPoint Presentation: Wikipedia defines JavaScript as: … a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions. It is also considered a functional programming language … JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics. 3PowerPoint Presentation: JavaScript adds a great deal of capability to SM. Here are some key points to remember: Server side only. JavaScript in SM uses a large number of extensions unique to SM. JavaScript code is integrated into current tools. Screens can be only defined in forms designer. JavaScript can execute RAD applications, but it cannot interact with them. JavaScript adds the ability to work with xml formatted data. 4Integration points: Integration points Format control Link Triggers Cascade updates Scripts Wizards ScriptLibrary Interoperability Displayscreens Displayoptions Process Schedule svcApprovalRole 5ScriptLibrary: ScriptLibrary The primary focus of JavaScript in Service Manager is in ScriptLibrary which is a new table It is the only place that JavaScript can be run stand alone It is the only source for shared functions 6Naming ScriptLibrary: Naming ScriptLibrary No spaces allowed Use lower case for the first letter Use upper case to separate word Use a prefix for your organization For example, a record holding service catalog function: ndpServiceCatalog 7Create a ScriptLibrary record : Create a ScriptLibrary record 1 Click on the Utilities tab, then the Tools button. 2 Click on Script Library . 3 Enter the Name myTest and click Add . 4 Fill in the script as shown. 8PowerPoint Presentation: 9 print (" Hello World! "); CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Hello World! Successful compilation of JavaScript function or expression Name: myTestScriptLibrary Features: ScriptLibrary Features Code stored in a character field The display object is a special JavaScript editor Color coded Find/replace Error checking Code commenting Line numbers No right click, use control-c, control-v 10Functions: Functions Changing the code into a function. The keyword function defines the function name. The curly braces { } contain the code. Use parenthesis () for parameters. function myFunction () { } 11PowerPoint Presentation: printMessage (); function printMessage () { print (" Hello World! "); } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Hello World! Successful compilation of JavaScript function or expression Name: myTest 12Calling the function: Calling the function The previous example called a function in the same ScriptLibrary record as the calling code. Normally the function is in a different ScriptLibrary record. The syntax for calling a function is lib. which means use the ScriptLibrary Then add myTest. which is the name of the specific ScriptLibrary record. This is followed by printMessage , which is the actual function. 13PowerPoint Presentation: 14 function printMessage () { print( "Hello World!" ); } Name: myFunctions lib.myFunctions.printMessage (); Name: myTest Messages Hello World! CLICKFunctions with a return: Functions with a return Functions can return only one value. Define a variable, test , to hold the returned value. A variable is defined by using the keyword var . Set the variable to the function. The function uses the word return to a value. 15PowerPoint Presentation: 16 var test = printMessage (); print ( test ); function printMessage () { print ( " Hello World!" ); return true ; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression true Hello World! Successful compilation of JavaScript function or expression Name: myTestVariables: Variables Variable names are words without dots Do not use the dollar sign Variable names ARE case sensitive Variables MUST be declared but, do not have to be typed The basics types are string, number, and boolean 17Variables: Variables Use var to declare a variable: Declare the variable, but not assign a value: var myVariable ; Declare the variable and assign it to the value of another variable: var myVariable = newValue ; 18PowerPoint Presentation: 19 var test = printMessage (); print ( test ); print ( name ); function printMessage () { print ( "Hello World!" ); var name = "TEST" ; return true; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Script ' mytest ' line 3: ERROR ReferenceError: name is not defined at char 1 true Hello World! Successful compilation of JavaScript function or expression Name: myTestPowerPoint Presentation: 20 var test = getFullName ("Tommy", "Test"); print(test); function getFullName ( first, last ) { return first + " " + last; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Tommy Test Successful compilation of JavaScript function or expression Name: myTestCalling JavaScript from RAD: Calling JavaScript from RAD When using normal RAD statements the jscall() is used to execute a ScriptLibrary function. jscall( LibName , function, parm1, parm2, … ) The function jscall() can set a variable or it can be used as a condition. If it is used as a condition then the function must return true or false. 21Using RAD variables: Using RAD variables RAD variables are available in JavaScript They need the path, either system.vars.$file Or, vars.$file All dots must be changed to underlines. $ L.file becomes vars.$L_file 22File variables: File variables In RAD a field name in a file variable is referenced with the in syntax: name in $file="TEST" In JavaScript the field is referenced with the dot syntax: myFile.name = "TEST"; All dots in the field name must be changed to underlines logical.name becomes logical_name myFile.logical_name = "CI001"; 23Arrays: Arrays Arrays are JavaScript objects They can be defines several ways: var myArray = new Array(); var myArray = []; Values can be put beteen the brackets: var myArray = [ “ dallas ”, “ austin ” ]; Refence the element with a number between the brackets myArray [3] = "operations"; The index starts with 0 not 1 as it does in RAD 24Arrays: Arrays The length of the arrays does not have to be declare Any element can be defined in any order Empty elements are null Arrays start numbering at 0, not 1. var a = arr [ 2 ]; var b = file.array [ 3 ]; var c = file.array [ 2 ].name; d[ 1 ] = "operations"; var e = new Array[ "test", "prod" ]; 25Using RAD Variables in JS: Using RAD Variables in JS All RAD variables are useable in JavaScript, but they must be modified. They must be proceeded by vars. For example: vars.$file Replace dots with underlines. For example: vars.$L_file For arrays use brackets. For example: vars.$lo_ucapex [ 1 ] 26Calling RAD Functions: Calling RAD Functions RAD functions can be called in JavaScript code. Use the syntax: var dNow = system.functions.tod (); Use JavaScript variables as parameters where needed. For example: var sub = system.functions.substr (string, 5, 3); Use either RAD or JavaScript variables 27Compiling: Compiling The compile button does not compile It does a syntax check It will catch: Unmatched parenthesis Unmatched brackets Lines without semi colon It will not catch: Bad functions Bad variables 28Compile error examples: Compile error examples Missing } Compilation of JavaScript function or expression failed ^ Script myTest line 8: ERROR SyntaxError : missing } after function body at char 6 Syntax error Compilation of JavaScript function or expression failed ^ functionx printMessage () { Script myTest line 4: ERROR SyntaxError : missing ; before statement at char 11 29Compile error examples: Compile error examples Missing ) Compilation of JavaScript function or expression failed ^ print( "Hello World!" ; Script ' myTest ' line 5: ERROR SyntaxError : missing ) after argument list at char 28 30PowerPoint Presentation: For more information go to www.newdaypress.com 31 You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
JavaScript for HP Service Manager Primer msanders747 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 159 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 06, 2012 This Presentation is Public Favorites: 0 Presentation Description HP Service Manager uses JavaScript for tailoring and controlling the workflow. This presentation provides a very basic introduction into how it works and is integrated into the product. For more information visit www.newdaypress.com. Comments Posting comment... Premium member Presentation Transcript New Day Press: New Day Press Presents Mike Sanders 1JavaScript Primer: JavaScript Primer For ServiceCenter and Service Manager 2PowerPoint Presentation: Wikipedia defines JavaScript as: … a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions. It is also considered a functional programming language … JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics. 3PowerPoint Presentation: JavaScript adds a great deal of capability to SM. Here are some key points to remember: Server side only. JavaScript in SM uses a large number of extensions unique to SM. JavaScript code is integrated into current tools. Screens can be only defined in forms designer. JavaScript can execute RAD applications, but it cannot interact with them. JavaScript adds the ability to work with xml formatted data. 4Integration points: Integration points Format control Link Triggers Cascade updates Scripts Wizards ScriptLibrary Interoperability Displayscreens Displayoptions Process Schedule svcApprovalRole 5ScriptLibrary: ScriptLibrary The primary focus of JavaScript in Service Manager is in ScriptLibrary which is a new table It is the only place that JavaScript can be run stand alone It is the only source for shared functions 6Naming ScriptLibrary: Naming ScriptLibrary No spaces allowed Use lower case for the first letter Use upper case to separate word Use a prefix for your organization For example, a record holding service catalog function: ndpServiceCatalog 7Create a ScriptLibrary record : Create a ScriptLibrary record 1 Click on the Utilities tab, then the Tools button. 2 Click on Script Library . 3 Enter the Name myTest and click Add . 4 Fill in the script as shown. 8PowerPoint Presentation: 9 print (" Hello World! "); CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Hello World! Successful compilation of JavaScript function or expression Name: myTestScriptLibrary Features: ScriptLibrary Features Code stored in a character field The display object is a special JavaScript editor Color coded Find/replace Error checking Code commenting Line numbers No right click, use control-c, control-v 10Functions: Functions Changing the code into a function. The keyword function defines the function name. The curly braces { } contain the code. Use parenthesis () for parameters. function myFunction () { } 11PowerPoint Presentation: printMessage (); function printMessage () { print (" Hello World! "); } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Hello World! Successful compilation of JavaScript function or expression Name: myTest 12Calling the function: Calling the function The previous example called a function in the same ScriptLibrary record as the calling code. Normally the function is in a different ScriptLibrary record. The syntax for calling a function is lib. which means use the ScriptLibrary Then add myTest. which is the name of the specific ScriptLibrary record. This is followed by printMessage , which is the actual function. 13PowerPoint Presentation: 14 function printMessage () { print( "Hello World!" ); } Name: myFunctions lib.myFunctions.printMessage (); Name: myTest Messages Hello World! CLICKFunctions with a return: Functions with a return Functions can return only one value. Define a variable, test , to hold the returned value. A variable is defined by using the keyword var . Set the variable to the function. The function uses the word return to a value. 15PowerPoint Presentation: 16 var test = printMessage (); print ( test ); function printMessage () { print ( " Hello World!" ); return true ; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression true Hello World! Successful compilation of JavaScript function or expression Name: myTestVariables: Variables Variable names are words without dots Do not use the dollar sign Variable names ARE case sensitive Variables MUST be declared but, do not have to be typed The basics types are string, number, and boolean 17Variables: Variables Use var to declare a variable: Declare the variable, but not assign a value: var myVariable ; Declare the variable and assign it to the value of another variable: var myVariable = newValue ; 18PowerPoint Presentation: 19 var test = printMessage (); print ( test ); print ( name ); function printMessage () { print ( "Hello World!" ); var name = "TEST" ; return true; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Script ' mytest ' line 3: ERROR ReferenceError: name is not defined at char 1 true Hello World! Successful compilation of JavaScript function or expression Name: myTestPowerPoint Presentation: 20 var test = getFullName ("Tommy", "Test"); print(test); function getFullName ( first, last ) { return first + " " + last; } CLICK CLICK CLICK Messages Successful compilation of JavaScript function or expression Tommy Test Successful compilation of JavaScript function or expression Name: myTestCalling JavaScript from RAD: Calling JavaScript from RAD When using normal RAD statements the jscall() is used to execute a ScriptLibrary function. jscall( LibName , function, parm1, parm2, … ) The function jscall() can set a variable or it can be used as a condition. If it is used as a condition then the function must return true or false. 21Using RAD variables: Using RAD variables RAD variables are available in JavaScript They need the path, either system.vars.$file Or, vars.$file All dots must be changed to underlines. $ L.file becomes vars.$L_file 22File variables: File variables In RAD a field name in a file variable is referenced with the in syntax: name in $file="TEST" In JavaScript the field is referenced with the dot syntax: myFile.name = "TEST"; All dots in the field name must be changed to underlines logical.name becomes logical_name myFile.logical_name = "CI001"; 23Arrays: Arrays Arrays are JavaScript objects They can be defines several ways: var myArray = new Array(); var myArray = []; Values can be put beteen the brackets: var myArray = [ “ dallas ”, “ austin ” ]; Refence the element with a number between the brackets myArray [3] = "operations"; The index starts with 0 not 1 as it does in RAD 24Arrays: Arrays The length of the arrays does not have to be declare Any element can be defined in any order Empty elements are null Arrays start numbering at 0, not 1. var a = arr [ 2 ]; var b = file.array [ 3 ]; var c = file.array [ 2 ].name; d[ 1 ] = "operations"; var e = new Array[ "test", "prod" ]; 25Using RAD Variables in JS: Using RAD Variables in JS All RAD variables are useable in JavaScript, but they must be modified. They must be proceeded by vars. For example: vars.$file Replace dots with underlines. For example: vars.$L_file For arrays use brackets. For example: vars.$lo_ucapex [ 1 ] 26Calling RAD Functions: Calling RAD Functions RAD functions can be called in JavaScript code. Use the syntax: var dNow = system.functions.tod (); Use JavaScript variables as parameters where needed. For example: var sub = system.functions.substr (string, 5, 3); Use either RAD or JavaScript variables 27Compiling: Compiling The compile button does not compile It does a syntax check It will catch: Unmatched parenthesis Unmatched brackets Lines without semi colon It will not catch: Bad functions Bad variables 28Compile error examples: Compile error examples Missing } Compilation of JavaScript function or expression failed ^ Script myTest line 8: ERROR SyntaxError : missing } after function body at char 6 Syntax error Compilation of JavaScript function or expression failed ^ functionx printMessage () { Script myTest line 4: ERROR SyntaxError : missing ; before statement at char 11 29Compile error examples: Compile error examples Missing ) Compilation of JavaScript function or expression failed ^ print( "Hello World!" ; Script ' myTest ' line 5: ERROR SyntaxError : missing ) after argument list at char 28 30PowerPoint Presentation: For more information go to www.newdaypress.com 31