How to execute action Email Purchase Order in Acumatica and how create PXAdapter

Hello everybody,

today I want to post code sample on how to execute menu item "Email Purchase Order" in Acumatica.

I mean this fragment of Purchase order screen:

If you'll try to find the source code of that Action or menu item, you'll be disappointed because you'll not find it. As some other actions, Email Purchase Order is implemented in Acumatica as combination of Automation steps with C# functions.

Below goes code sample, that allows you to call that method with help of static method:

public static void SendNotificationForGraph(POOrderEntry graph, POOrder order)
    graph.Document.Current = graph.Document.Search<POOrder.orderNbr>(order.OrderNbr, order.OrderType);
    var adapter = new PXAdapter(graph.Document);
    adapter.SortColumns = new string[] { typeof(POOrder.orderNbr).Name };
    adapter.Searches = new object[] { order.OrderNbr };
    adapter.Menu = "Email Purchase Order";
    adapter.Arguments = new Dictionary<stringobject>();
    adapter.MaximumRows = 1;
    List<object> list = new List<object>();
    foreach (var r in graph.action.Press(adapter))

Another very interesting part of that code is that it shows how to create instance of PXAdapter class in Acumatica.

No Comments

Add a Comment