Infor Technology Blog

« | Main | »

Scripting Tools in Infor Smart Office for Infor Lawson – Part 2

April 19, 2017

By Vince McGowan, Senior Principal Software Engineer

Scripting in Infor Smart Office for Infor Lawson

This is the second of our 3-part series on Infor Lawson scripting tools available in Infor Smart Office for Infor Lawson Applications. In this post we will look at the Lawson Object Browser.

Lawson Object Browser

The Lawson Object Browser is an Infor Smart Office tool that both documents the objects, properties, events and functions supported by the scripting model and is a source of help with many script examples.

While the Infor Lawson Developers Guide document is available with each release of Infor Smart Office – found in the SDK Documentation folder – the Lawson Object Browser is much more accessible, contains the latest scripting features and integrates with the Infor Lawson Scripting Tool.

With scripting access, the user can open the tool from the Navigator widget – Infor Lawson -> Other -> Lawson Object Browser – or from the Help menu in the Infor Lawson Script Tool. In addition, integration with the Script Tool is provided by positioning the cursor within the Script editor on a known Infor Lawson method or property and pressing the F1 key which launches the Browser and displays that item’s information, often with script examples.

Lawson Object Browser

Since Infor Smart Office is built on Microsoft technology and script is developed in the Jscript.NET language, additional information about JScript, WPF, .NET can be found on various Microsoft sites:
Microsoft Developer Network

JScript .NET Language Reference

JScript .NET Articles

Windows Presentation Foundation

The Object Browser consists of a tree view control that displays all of the Infor Lawson objects. As each tree of the branch is expanded, categories of members are displayed which likewise can be expanded to show each category members.

Infor Lawson Objects in the Lawson Object Browser

The screen shot below shows the display of the IForm interface BeforeTransaction event and example script of how the event can be handled.

Transaction Events

Event handlers receive two parameters: the object which triggers the event (sender) and an event arguments object, by convention named ‘e’ or ‘eventArgs’. The event arguments object is specific to each type of handler and often contains information about the current state of execution. Some event handlers allow the event to be interrupted or cancelled by setting the Cancel property of ‘e’ to True. Typically, the sender is the form object or a control you have added to the form, such as a button. Though it is possible to attach a single handler to multiple controls, say a Click handler to multiple buttons, it is not recommended just for clarity of the script.

Note the Share menu and toolbar buttons available in the upper right corner of the display. The Share menu is a standard feature for Infor Smart Office that allows you to share either a shortcut to or an image of the current display.

The Copy button allows you to copy any example script displayed to the Windows clipboard for pasting into the Script editor. The Print button allows you to capture and print an image of the current display to your local printer.

Infor Smart Office Sharing


In many cases, where an Infor Lawson object is referenced in comments, they are cross-linked for easier access. As an example, event argument objects are typically linked with the IForm event that requires their use. In this screen shot, you can see the AfterCustomDrillSelectEventArgs link to the AfterCustomDrillSelect event and the ControlsUtil.SetupDrillSelect method.

After custom drill select event

The Infor Lawson Developers Guide no longer includes extended code examples. Instead, many specific coding examples are maintained under the Code Examples branch of the Object Browser. Example code can be copied to the Windows clipboard in its entirety by clicking the Copy button or partial snippets can be highlighted and copied.

Trigger a button click

In the next post, the final of three on Infor Lawson scripting, we will look at the API Builder utility.


Leave a Reply

Your email address will not be published.