Leave feedback
  • Featured

    Override delivery settings in M3 / Movex projects

Write an Article
Monday 29 November, 2010
Andreas Hjelle Andreas Hjelle
6 likes 5273 views

This article describes how you can override the delivery settings in M3 projects. By default delivery is set in M3 and the Movex Agent pick up delivery information like *MAIL ,*PRT and so on. These settings are placed in read only variables that you can’t modify.


A common scenario would be that StreamServe receives a job from M3 with several events (separated by the BEGIN keyword). In the job header are a set of delivery settings that decides where the complete job shall be delivered. Let’s say that you want to override the delivery based on values in each event.


The first thing you have to do is to turn off “select automatically” in runtime. Right click on the process. Select “Settings” and go to the “General” pane. Tick off select automatically.


Then you have to select out connector dynamically. This is done by adding a variable in the connector selection. Right click on the process and select “Connector Selection”.  Add a variable.


This has to be done for all processes you want to control with scripting.


If the connector is of types Spool or File you also have to make sure that the printer name or file path are selected dynamically. This is made on the Platform. Open the out connector and in the To property add a “%”.




Process settings

Now the Platform and Runtime are prepared. Next step is to use scripting to call the correct process and use the right delivery channel.

With the M3 documents from Lawson a function file with the function AgentDriver is delivered (I’ll attach the function here as well). This function will allow you to use “metadata” sent from M3 and override them. 

Let us say that you have the following metadata for the job


In the Message script After you can add a script like this:

if(num($AHWKHRET) = 0){
  $PageOutName = "MMS480AH";//this tells the AgentDriver function which page out process you want to use…

After the AgentDriver function has been called the variables $mvx_PRT = “YES” and $printer = PRT01, $que = the corresponding out connector for $printer from quealias and $outpath the physical printer from quealias.

On the process add a script like this:

If($myCondition = “1” and $mvx_PRT=”YES”){
$que = “PS”; //use the post script out connector
$OutPath = \\myServer\thePostScriptPrinter;
Else {
//use settings from AgentDriver
SetDestPath($OutPath);//this directs the output to the actual printer

Of course you could also set all the values manually and only use CallProc($PageOutName). However, you’ll have to write quite a few lines of code to take care of all the different variations of delivery. In the above case only printing are affected. If the document are sent on mail, the settings from M3 are used as is.



Attached files

Comments (5)

  • +1 Andreas.

    Monday 29 November, 2010 by Stefan Cohen
  • Härligt att se att mitt namn lever kvar. :)

    Good work!

    MVH Svante Grute

    Friday 25 February, 2011 by Svante Grute
  • Hei Svante,

    Det ser ut som det ikke er gjort noen endringer på funksjonen du skrev i 2003. Det er jo ingen grunn til å endre på noe som fungerer.



    Friday 25 February, 2011 by Andreas Hjelle
  • Svante
    Wonderful to see that my name lives on.
    It looks like there are no changes to the function that you wrote in 2003. There is no reason to change something that works.
    Monday 27 June, 2011 by Phil Runciman
  • I have followed the same steps as you mentioned in this post. Only difference is in my scenario is it has been configured to the DAF. After this change all others are work as expected , but DAF does not pick the destination file and path from the dafsettings table and the destination file name . What could be the possible reason for that?

    Wednesday 23 September, 2015 by Prabodha Amarapema


Post comment