Tag Archives: JScript

Custom data templates in M3 lists with JScript

Changing the appearance of M3 list cells with conditional styles is easy but in some cases you need to do things that require logic that cannot be expressed with conditional styles alone. This post will show you how to change the style of list cells in M3 lists using JScript, custom data templates and custom data template selectors.

Continue reading

Hyperlink columns in M3 lists

This post is a follow-up to a question in the comment section on a previous post called Adding a new column in a M3 List. The question was how to add a clickable hyperlink in a new list column. This could be solved in a generic way by creating your own data template and template selector or by reusing existing functionality in MForms. In this post I will just cover the second part by reusing existing functionality. The more generic solution for custom content in list cells might be covered in a future post.

Continue reading

Controlling the user’s canvas with stand-alone Jscripts

The user’s canvas is where the user has his shortcuts and widgets monitoring business data. The first time the user starts Smart Office she will get the default Canvas with the content that an administrator has configured. In this post I’ll show you how to share a canvas file on a fileshare and create a Jscript that will load the Canvas everytime Smart Office starts.

Continue reading

Handling navigation events in a modal browser window using JScript

This post will cover a very specific scenario that relates to the areas of modal tasks, the WebBrowser control and navigation events. We got a question on how to close a modal browser window in Smart Office when the browser control navigated to a specific URL. The answer is not obvious so this post will show one way to solve this using JScript. Continue reading

Introduction to MForms extensions

When extending the functionality of M3 panels in MForms you have three different options and these are JScript files, Script assemblies and MForms extensions. MForms extensions allow you to do similar things as with a regular JScript files but extensions are Smart Office features, written in a .NET language such as C#. The way extensions are deployed, configured and registered is also somewhat different compared to how you usually do with JScript.

This post is a brief introduction of how to create and deploy an MForms extension using the Smart Office SDK. Note that if you don’t have access to the SDK you will not be able follow along in the example on your own. I will also assume that you are familiar with the Smart Office SDK and will mainly focus on what is specific for MForms extensions.

Continue reading

Script assemblies in MForms

The most common way to extend the functionality of M3 panels in MForms is to use JScript files but there are other options such as Script assemblies and MForms extensions. With Script assemblies you can write code in most languages supported by .NET such as C# and VB.Net and you can actually debug your code using Visual Studio. Instead of deploying the script as a JScript file you use a .NET assembly in the form of a DLL file.

Continue reading

Getting values from M3 panels with Jscript

Almost every M3 script needs to get values from the panel it is running on at some point and there are quite a few different ways to accomplish this. The script might need the value of a specific TextBox, the value of a cell on the selected list row or it might need to know what the name of the current program is. These are just a few examples and there are many more. This post will show how to get values from M3 panels in the most common scenarios.

Continue reading

Tooltips with MI data in M3 lists

A script requirement we recently heard of was to be able to show tooltips on cells in a M3 list and that the tooltip value should be retrieved using a MI-program. The specific requirement was to get the user name for list columns that contains M3 user IDs. The idea is to use this in M3 lists where the user ID is shown in a column but the user name is not part of the list. Continue reading

Improvements in JScript logging

Introduction

Since there is no way to debug a JScript in LSO developers have to use other means to find errors. This can include writing to the debug console in the Script Tool, writing to the Smart Office log file or the classic, showing dialog boxes.

In many cases you want to write both to the debug console for development purposes and to the log file for troubleshooting deployed scripts. One way to solve this is to create your own wrapper functions that does both these things and some of you have probably done this already. To make logging a bit easier from JScript we have added some new methods and properties to the ScriptDebugConsole class. First I will describe how a log wrapper function might be implemented and then how the new API methods can be used to remove the need for a wrapper function. Continue reading

Pressing KeyDown in a M3 list to load all rows

This post will cover something that you can do in JScript that is actaully on the edge of what you can but shouldn’t do. JScript is a great tool for doing small enhancements to M3 panels and S3 forms. However doning more advanced stuff requires a lot of experience. There are however a few tricks that you pick up along the way. In this post I’ll show you two useful things.

1. How to log to the Lawson Smart Office log file.
2. How to simulate pressing a key, in this case we will use page down.
3. How to run against your own local script instead of the central deployed onces. Continue reading

Using JScript and a Mashup to browse for values on M3 panels

The goal of this post is to show how JScript and Mashups can be used to extend the browse functionality in M3. The idea is simple, instead of using the M3 Browse dialog to find a field value on a panel a custom built Mashup is used instead. The Mashup can use M3 panels with Enterprise Search, data services and all the other Mashup controls to improve the browse experience for the user.

The solution consists of two parts, a generic JScript and one or more browse Mashups. The browse Mashup is started using a button or a keyboard shortcut, the user selects something in the Mashup and then one or more values from the Mashup are used to update fields on the panel. The rest of the post will cover a simple browse Mashup and the important parts of the JScript. Continue reading

Validating M3 panels using JScript and MI programs before a request

The scenario for this post is to be able to verify something on a panel in a M3 program before a request is submitted to the M3 BE server. The validation in the example will be made using a MI program that is called asynchronously. The example is not a realistic case but it is easy to test and can be modified and generalized for real business cases. Note that the script is just an example and not intended for production use. Continue reading

Personalizations in M3

Users can change panels in MForms to obtain personalized versions of the standard M3 panels. Examples of personalization are conditional styles, hyperlinks, tab order, label texts and JScripts. Personalization is done directly within MForms using dialogs and special edit mode panels. There is a Personalization menu available under the Tools menu and on the context menu for the panel that contains the available personalization options. Continue reading