I was requested to share some of my experience with MFORMS Automation and JScript.NET by Thibaud and here it is. MForms automation is simply a great alternative to perform data modification in M3, if you are left with no other option which was my case.
In our M3 implementation, we are using Std. Document Connect Media to deliver documents (example, Purchase orders) to our clients. These media entities like email addresses are setup in the program CRS945/949. This M3 program does not have an API implemented for data access. The alternative to using API was creating a Lawson Web service i.e. adding the customer to the program by simulating the panel sequence in LSO.
In CRS945, adding a document media control object involves the selection of document number (W1DONR). This step determines the kind of document selected and hence the other inputs (customer number, supplier ID or warehouse ID). In this example, document number 231 implies Order Confirmation document which requires a Customer number field which gets added to the panel.
Since the Customer Number gets added to the A-panel dynamically after the document number selection, creating a Lawson web service is not a possibility. This is due to the fact that Lawson Web Services designer does not allow “A or B Panel with ENTER followed by panels A, B” which is the case here. So web service was eliminated as an option which would have allowed us to add all the documents en masse by calling it repeatedly which was our requirement.
This left us with one and only option which was MForms automation. We ended up creating the MForms automation steps which would accomplish the task on hand and it looks as follows:
Note: Step command F3 which closes the panel is missing in this diagram. It is a critical step.
As you can see the sequence of steps are it easy to follow. Step one starts by running the program required which CRS945. In step two we end setting the value for the document number followed by an action step ‘ENTER’. Step 4 is another action which is to create the document connection. Finally we add the name and description for the connection and press ‘ENTER’. I have recreated these same steps using Jscript.NET and here it is:
As you can see the inputs for my MForms automations are provided from an Excel document (column 1: Document number, column 2: Customer number). This allows us to input multiple rows in one attempt. Running this Jscript using LSO on CRS945 adds the document connection for all our customers.