Open a designer layout from add-ons

Massimiliano Luppis

I wish open a layout built with the designer. Basically I need to run some operations before printing and I want more control on user input parameters, so I create a class to execute the layout.
I saw an example in the customize forum based on LayoutHelper class and I thinked that it could be the solution; however when calling the method nothing happen, no errors and no actions, maybe I didn't understand how the LayoutHelper works.
This is my code:

class CallReports
public void CallLayout()
// next comment only to ensure class is running
SwissAddonFramework.UI.Dialogs.MessageBox.Show("CallReports", "OK");

LayoutHelper.LayoutOpener.OpenLayout(LayoutHelper.LayoutOpener.OpenLayoutModes.Print, "139",
"DocNum", "15");
catch (Exception e)
SwissAddonFramework.UI.Dialogs.MessageBox.Show(e.Message, "OK");

Marco Schweighauser

You have to reference the Assembly LayoutHelper.dll to compile the code.
To run your code coresuite designer has to be running. If think you can only test your code after you built a SIP and run your add-on like the user does (not from the development environment).

Kind regards,


Massimiliano Luppis

Hi Marco,
I already referenced the LayoutHelper.dll; testing the code I referenced all the SWA_.dll I can find ...
Well the "SIP way" did not change the thing:
the designer is running and my code is compiled and installed by a sip but the form is still not visible.
I also tried to insert a Show.Message before calling the form, just to ensure the dll is working: the message is displayed but not the form.
Do you think that there are some methods that I have to call before calling LayoutOpener, something like LD.Start ?

Philipp Knecht


Another thing i've disovered.

Use DocEntry not DocNum as the Parameter.

Please use the ExecutePrintDef Method to Print a Layout from scripts.
You have way more control on the Layout to print and there will be no Printdef Chooser if there are more than one Printdef defined for the Formtype.[action]=list_post&tx_mmforum_pi1[tid]=2013&tx_mmforum_pi1[pid]=6814&tx_mmforum_pi1[sword]=ExecutePrintdef




Please sign in to leave a comment.

Didn't find what you were looking for?

New post