Send attachments of the subcontract through "Email Subcontract" action.

  • 3 September 2021
  • 3 replies

Userlevel 2


I’m working on a customization where I have to attach subcontract files to Email subcontract action. So end user will get subcontract attachments in the email along with the default report.

At present, acumatica allows only to send report assigned to subcontract in preference will send through email subcontract action. Along with report, I need to attach that particular record file with it.

The action code contains SENDNotificaiton method with the attachment parameter.

But with below code i’m able to send NOTEID of the file to the sendnotificaiton method but I’m unable to see my file in “ALL Email” screen.

Base.Activity.SendNotification(APNotificationSource.Vendor, notificationCD, order.BranchID, parameters, _attachments);

I’m sending NoteID value of the record to this method from my extended graph but the files are not attaching to the email. 


I have tried below code:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.CM;
using PX.Objects.CN.CacheExtensions;
using PX.Objects.CN.Common.Extensions;
using PX.Objects.CN.Common.Helpers;
using PX.Objects.CN.Subcontracts.PO.CacheExtensions;
using PX.Objects.CN.Subcontracts.SC.DAC;
using PX.Objects.CN.Subcontracts.SC.Descriptor.Attributes;
using PX.Objects.CN.Subcontracts.SC.Views;
using PX.Objects.Common;
using PX.Objects.Common.Extensions;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.CT;
using PX.Objects.DR;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PoMessages = PX.Objects.PO.Messages;
using ScMessages = PX.Objects.CN.Subcontracts.SC.Descriptor.Messages;
using ScInfoMessages = PX.Objects.CN.Subcontracts.SC.Descriptor.InfoMessages;
using PX.Objects;
using PX.Objects.CN.Subcontracts.SC.Graphs;

namespace PX.Objects.CN.Subcontracts.SC.Graphs
public class SubcontractEntry_Extension : PXGraphExtension<SubcontractEntry>
#region Event Handlers
//public delegate IEnumerable NotificationDelegate(PXAdapter adapter, String notificationCD);
//public IEnumerable Notification(PXAdapter adapter, String notificationCD, NotificationDelegate baseMethod)

// return baseMethod(adapter,notificationCD);
private IList<Guid?> _attachments;

public PXAction<POOrder> notification;

[PXUIField(DisplayName = "Notifications", Visible = false)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
protected virtual IEnumerable Notification(PXAdapter adapter,
[PXString] string notificationCD)
foreach (POOrder order in adapter.Get<POOrder>())
Base.Document.Cache.Current = order;
var parameters = new Dictionary<string, string>();
parameters["POOrder.OrderType"] = order.OrderType;
parameters["POOrder.OrderNbr"] = order.OrderNbr;

using (var ts = new PXTransactionScope())
if (Base.Accessinfo.ScreenID == "SC.30.10.00")
_attachments = new List<Guid?>();
// _attachments.Add();
_attachments.Add(order.NoteID); // sending attachement parameter value here
Base.Activity.SendNotification(APNotificationSource.Vendor, notificationCD, order.BranchID, parameters, _attachments);
Base.Activity.SendNotification(APNotificationSource.Vendor, notificationCD, order.BranchID, parameters);


yield return order;



Can anyone guide me to achieve this or any alternate step to send attachments through same action?

Thanks in advance.



Best answer by manfredpeukert12 3 August 2023, 17:33

View original

3 replies

Probably the problem has already been solved. But if you read the guids from NoteDoc, it works.

 var notes =  SelectFrom<NoteDoc>.Where<NoteDoc.noteID.
                foreach (NoteDoc note in notes)

Userlevel 1

@jpavain I think you were able to create a customization to pull attachments into the send email feature.  Can you review the above to see what we may be doing wrong?


Userlevel 1

Were you able to find a solution?  I have a customer with a similar request.




About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved