Infor M3 H5 Development Guide

[Pages:92]Infor M3 H5 Development Guide

Version 10.3.1.0 Published May 2017

Copyright ? 2017 Infor

Important Notices

The material contained in this publication (including any supplementary information) constitutes and contains confidential and proprietary information of Infor.

By gaining access to the attached, you acknowledge and agree that the material (including any modification, translation or adaptation of the material) and all copyright, trade secrets and all other right, title and interest therein, are the sole property of Infor and that you shall not gain right, title or interest in the material (including any modification, translation or adaptation of the material) by virtue of your review thereof other than the non-exclusive right to use the material solely in connection with and the furtherance of your license and use of software made available to your company from Infor pursuant to a separate agreement, the terms of which separate agreement shall govern your use of this material and all supplemental related materials ("Purpose").

In addition, by accessing the enclosed material, you acknowledge and agree that you are required to maintain such material in strict confidence and that your use of such material is limited to the Purpose described above. Although Infor has taken due care to ensure that the material included in this publication is accurate and complete, Infor cannot warrant that the information contained in this publication is complete, does not contain typographical or other errors, or will meet your specific requirements. As such, Infor does not assume and hereby disclaims all liability, consequential or otherwise, for any loss or damage to any person or entity which is caused by or relates to errors or omissions in this publication (including any supplementary information), whether such errors or omissions result from negligence, accident or any other cause.

Without limitation, U.S. export control laws and other applicable export and import laws govern your use of this material and you will neither export or re-export, directly or indirectly, this material nor any related materials or supplemental information in violation of such laws, or use such materials for any purpose prohibited by such laws. Trademark Acknowledgements

The word and design marks set forth herein are trademarks and/or registered trademarks of Infor and/or related affiliates and subsidiaries. All rights reserved. All other company, product, trade or service names referenced may be registered trademarks or trademarks of their respective owners. Publication Information

Release: Infor M3 H5 10.3.1.0

Publication date: < May 10, 2017 >

Contents

About this guide................................................................................................................................... 9 Related documents .......................................................................................................................... 9 Contacting Infor................................................................................................................................ 9 The H5 Scripting Blog .................................................................................................................... 10

Chapter 1 Introduction .................................................................................................................. 11 Scripting overview.......................................................................................................................... 11 Resources ...................................................................................................................................... 11 Creating a script in M3 H5 ............................................................................................................. 12 Contents of a script file .................................................................................................................. 12 Example Script......................................................................................................................... 12 Init method ............................................................................................................................... 12 Element parameter .................................................................................................................. 13 Args parameter ........................................................................................................................ 13 Controller parameter................................................................................................................ 13 Log parameter ......................................................................................................................... 13 Debug parameter (deprecated) ............................................................................................... 13 M3 H5 limitations ........................................................................................................................... 14 M3 H5 script minification................................................................................................................ 14

Chapter 2 Developing scripts ....................................................................................................... 15 Development environment............................................................................................................. 15 Prerequisites............................................................................................................................ 15 Using Visual Studio ................................................................................................................. 15 Configuring the project ...................................................................................................... 15 Running Samples .............................................................................................................. 16 Debugging ......................................................................................................................... 16 Adding a new script to the solution ................................................................................... 17 Using VS Code and Node.js.................................................................................................... 17

Infor M3 H5 Development Guide | 3

Contents

Opening project in VS Code.............................................................................................. 17 Running Samples on a Node.js server ............................................................................. 17 Adding a new script to the project ..................................................................................... 18 Debugging in browsers............................................................................................................ 18 MForms Panel Layout.................................................................................................................... 18 Adding Content to a Form ....................................................................................................... 19 Element layout ......................................................................................................................... 19 Events ...................................................................................................................................... 19 Example................................................................................................................................... 19

Chapter 3 Deploying scripts ......................................................................................................... 21 Deploying a customized script in M3 H5 ....................................................................................... 21

Chapter 4 Adding scripts to a form ............................................................................................. 23 Adding a personalized script to a form .......................................................................................... 23 Adding a script shortcut ................................................................................................................. 23

Chapter 5 Public APIs.................................................................................................................... 25 API Overview ................................................................................................................................. 25 InstanceController.......................................................................................................................... 25 Properties ................................................................................................................................ 25 RenderEngine: RenderEngine .................................................................................. 25 Requesting: InstanceEvent .................................................................................... 26 Requested: InstanceEvent ...................................................................................... 26 RequestCompleted: InstanceEvent ....................................................................... 26 Functions ................................................................................................................................. 26 GetContent()...................................................................................................................... 26 GetContentElement() ........................................................................................................ 26 GetElement() ..................................................................................................................... 26 GetGrid()............................................................................................................................ 27 GetInstanceId().................................................................................................................. 27 GetMode() ......................................................................................................................... 27 GetPanelName() ............................................................................................................... 27 GetProgramName()........................................................................................................... 28 GetSortingOrder().............................................................................................................. 28 GetValue() ......................................................................................................................... 28 GetView()........................................................................................................................... 28 ListOption() ........................................................................................................................ 29

4 | Infor M3 H5 Development Guide

Contents

PageDown()....................................................................................................................... 29 PressKey() ......................................................................................................................... 29 SetValue().......................................................................................................................... 29 ShowMessage() ................................................................................................................ 30 ShowMessageInStatusBar() ............................................................................................. 30 Request Event Arguments............................................................................................................. 30 RequestEventArgs .............................................................................................................. 30 CancelRequestEventArgs ................................................................................................. 30 RenderEngine ................................................................................................................................ 31 Properties ................................................................................................................................ 31 Content: ContentElement ........................................................................................ 31 Functions ................................................................................................................................. 31 ShowMessage() ................................................................................................................ 31 ListControl ...................................................................................................................................... 31 Properties ................................................................................................................................ 32 ListView ......................................................................................................................... 32 Functions ................................................................................................................................. 32 Columns() .......................................................................................................................... 32 GetColumnIndexByName() ............................................................................................... 32 Headers()........................................................................................................................... 32 ListView.......................................................................................................................................... 33 Functions ................................................................................................................................. 33 GetValueByColumnIndex() ............................................................................................... 33 GetValueByColumnName()............................................................................................... 33 SelectedItem() ................................................................................................................... 33 SetValueByColumnIndex()................................................................................................ 34 SetValueByColumnName() ............................................................................................... 34 ScriptDebugConsole (deprecated) ................................................................................................ 34 Functions ................................................................................................................................. 35 WriteLine()......................................................................................................................... 35 Clear()................................................................................................................................ 35 ScriptLog ........................................................................................................................................ 35 Functions ................................................................................................................................. 35 Error() ................................................................................................................................ 35 Warning()........................................................................................................................... 36 Info() .................................................................................................................................. 36 Debug().............................................................................................................................. 36

Infor M3 H5 Development Guide | 5

Contents

Trace() ............................................................................................................................... 36 SetDefault() ....................................................................................................................... 37 SetDebug() ........................................................................................................................ 37 SetTrace().......................................................................................................................... 37 ScriptUtil......................................................................................................................................... 37 Functions ................................................................................................................................. 38 AddEventHandler()............................................................................................................ 38 ApiRequest() (deprecated) ................................................................................................ 38 DoEnterpriseSearch()........................................................................................................ 39 FindChild() ......................................................................................................................... 39 GetFieldValue() ................................................................................................................. 39 GetUserContext() .............................................................................................................. 40 Launch() ............................................................................................................................ 40 LoadScript() ....................................................................................................................... 40 OpenMenu() ...................................................................................................................... 41 RemoveEventHandler()..................................................................................................... 41 SetFieldValue().................................................................................................................. 41 SessionCache ................................................................................................................................ 42 Functions ................................................................................................................................. 42 Add() .................................................................................................................................. 42 ContainsKey().................................................................................................................... 42 Get() .................................................................................................................................. 43 Remove()........................................................................................................................... 43 InstanceCache ............................................................................................................................... 43 Functions ................................................................................................................................. 44 Add() .................................................................................................................................. 44 ContainsKey().................................................................................................................... 44 Get() .................................................................................................................................. 44 Remove()........................................................................................................................... 45 ConfirmDialog ................................................................................................................................ 45 Functions ................................................................................................................................. 45 ShowMessageDialog() ...................................................................................................... 45 ContentElement ............................................................................................................................. 46 Functions ................................................................................................................................. 47 Add() .................................................................................................................................. 47 AddElement()..................................................................................................................... 47 CreateElement() ................................................................................................................ 47

6 | Infor M3 H5 Development Guide

Contents

GetContentBody() ............................................................................................................. 48 GetElement() ..................................................................................................................... 48 GetPrevContainer() ........................................................................................................... 48 OnUnload() ........................................................................................................................ 49 Unload() ............................................................................................................................. 49 MFormsAutomation ....................................................................................................................... 49 Functions ................................................................................................................................. 50 addStep()........................................................................................................................... 50 addField() .......................................................................................................................... 50 setFocus().......................................................................................................................... 50 toEncodedURI()................................................................................................................. 51 MIService ....................................................................................................................................... 51 Functions ................................................................................................................................. 51 executeRequest() .............................................................................................................. 51 execute()............................................................................................................................ 52

Chapter 6 MForms Automation .................................................................................................... 53 What is MForms Automation? ....................................................................................................... 53 Automation Sequences.................................................................................................................. 53 Automation Steps .................................................................................................................... 54 Automation Fields.................................................................................................................... 54 Example............................................................................................................................. 55 Automation XML ...................................................................................................................... 55 Examples........................................................................................................................... 55 Starting Automations in M3 H5................................................................................................ 56 URI Format........................................................................................................................ 56 Example............................................................................................................................. 56 Helper Class ............................................................................................................................ 56

Chapter 7 MI Service...................................................................................................................... 57 MIRequest...................................................................................................................................... 57 Example ......................................................................................................................................... 58

Chapter 8 Drillback ........................................................................................................................ 59 Invoking a drillback ........................................................................................................................ 59 panyon.client.sendPrepareDrillbackMessage()........................................................ 59 Drillback parameters...................................................................................................................... 59 Examples ................................................................................................................................. 60

Infor M3 H5 Development Guide | 7

Contents

Chapter 9 Best practices............................................................................................................... 63 Use H5 functions and properties that are documented................................................................. 63 Use recommended API functions .................................................................................................. 63 Use proper logging utility ............................................................................................................... 64 Use TypeScript .............................................................................................................................. 64 Be wary of using ES6/ES2016 features ........................................................................................ 64 Minify scripts .................................................................................................................................. 64

Chapter 10 Script examples............................................................................................................ 65 H5SampleHelloWorld.ts................................................................................................................. 65 H5SampleUserDetails.ts................................................................................................................ 66 H5SampleShowXml.ts ................................................................................................................... 67 H5SampleOptionButton.ts ............................................................................................................. 68 H5SamplePreviewListHeader.ts .................................................................................................... 70 H5SampleShowOnMap.ts ............................................................................................................. 72 H5SampleMFormsAutomation.ts................................................................................................... 74 H5SampleRegexValidator.ts ......................................................................................................... 75 H5SampleRequestTracer.ts .......................................................................................................... 78 H5SampleCancelRequest.ts ......................................................................................................... 80 H5SampleOpenFieldHelp.ts .......................................................................................................... 81 H5SampleCustomColumns.ts ....................................................................................................... 82 H5SampleMIService.ts .................................................................................................................. 83 H5SampleImageFromList.ts .......................................................................................................... 87 H5SampleDrillback.ts .................................................................................................................... 89

Chapter 11 Appendix ....................................................................................................................... 91 Node.js ........................................................................................................................................... 91 Install Node.js .......................................................................................................................... 91 Verify the Node package manager.......................................................................................... 91 Verify the Node executable ..................................................................................................... 92 TypeScript...................................................................................................................................... 92

8 | Infor M3 H5 Development Guide

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download