ExecutePrintDef email parameters

John O'Brien

Hi all,

Is there a doc that explains what params to use with the ExecutePrintDef command, especially for emailing.

I am trying to auto email from a rule, code is as follows:

When using:

ExecutePrintDef("Stocktransfer_8003", true, LayoutHelper.LayoutOpener.OpenLayoutModes.Email,

How do I know what params to use to indicate document to email and address data, and in what order are they expected?



Paolo Manfrin

Hi John,

if you press F1 you will access the country package documentation where the parameters are explained.

You can use all the parameters defined in the layoutdefinition linked to the printdefinition you are calling (see the parameter tab).

Order is not relevant,

All the parameters should be in "paramName1", "valueNam1", "paramName2", "valueName2", etc...



Anders Olsson

Hi John,

It's been a while, good to see you here!

ExecutePrintDef is an EasyFunction command but can also be used in C# rules.

In the code editor, hit F1 and go to Easy Functions > Creating a rule from the customize menu > Parameters and Functions > Command Editor > Easy Function commands. There is a list of all Easy Function commands including examples.

The syntax is ExecutePrintDef("PrintDefId|OpenLayoutMode|Parameters") (yes, it's one single string argument).

Parameters are passed in in the following format: param1;value1;param2;value2 etc.

The order is not important.

As you can see in F1 Help you can use placeholders to pass in form/datasource values.

You can see required parameters in the Layout Definition for your layout (Parameters tab).



Anders Olsson

ok, it was already answered...

John O'Brien

Hey guys,

Thanks a lot for the help so far.

Hey Anders, great to see you on here too!

This is a rule that Paolo wrote for me before that I'm now trying to use and understand.

It's used to email a stock transfer after its added.

When I add a stock transfer im getting an error: "address parameter cannot be a blank string".

This is the code that I'm using:

LayoutHelper.LayoutOpener.ExecutePrintDef("Stocktransfer_8003", true, LayoutHelper.LayoutOpener.OpenLayoutModes.Email, "DocNum", docNum, "DocSeries", series, "Text01", mailFrom, "Text02", mailTo);

My SMTP is already set up in Designer - Configuration.

I think I'm missing something in my Layout Def or my Print Def?

Also, the parameters in Paolo's code above looks different to how the doc explains it!

Thanks again for the help!


Anders Olsson

Hi John,

Apologies for my late reply.

In the print definition (Email/Fax tab), hit F1 to see the online help. There you can see how to set a to address using an sql query (you don't pass it in through code). For from address you can set a static email address or use a query as well.

You can view the required parameters by opening the Layout definition (in the print def Document tab, double click the layout). All parameters are listed in the Parameters tab.

I misunderstood your request from the beginning; I thought you were using Easy Functions which uses a different syntax.

You will probably want to use the following code unless you have added parameters to the layout:

LayoutHelper.LayoutOpener.ExecutePrintDef("Stocktransfer_8003", true, LayoutHelper.LayoutOpener.OpenLayoutModes.Email, "DocNum", docNum, "DocSeries", series);





Please sign in to leave a comment.

Didn't find what you were looking for?

New post