Question

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

  • 3 September 2021
  • 0 replies
  • 82 views

Hello,

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);
//[PXOverride]
//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);
}
else
{
Base.Activity.SendNotification(APNotificationSource.Vendor, notificationCD, order.BranchID, parameters);
}
Base.Save.Press();

ts.Complete();
}

yield return order;
}
}


#endregion
}
}

 

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

Thanks in advance.

 


0 replies

Be the first to reply!

Reply


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 — 2020  Acumatica, Inc. All rights reserved