We would like to have our attribute that is listed on the opportunity to transfer over to the service order when it is converted. It is the exact same attribute defined for both the service order and the opportunity and it should transfer over.
I have done some digging on here and have found this to override the CreateSrvOrdDocument action and then found this solution by
using PX.Data;
using PX.Objects.CS;
using PX.Objects.FS;
using System.Collections.Generic;
namespace PX.Objects.CR
{
public class DialogBoxSOApptCreation_Ext : PXGraphExtension<SM_OpportunityMaint_DBox, SM_OpportunityMaint, OpportunityMaint>
{
public static bool IsActive() => PXAccess.FeatureInstalled<FeaturesSet.serviceManagementModule>();
#region Event Handlers
public delegate void CreateDocumentDelegate(ServiceOrderEntry srvOrdGraph, AppointmentEntry apptGraph, DBoxHeader header, List<DBoxDetails> details);
PXOverride]
public void CreateDocument(ServiceOrderEntry srvOrdGraph, AppointmentEntry apptGraph, DBoxHeader header, List<DBoxDetails> details, CreateDocumentDelegate baseMethod)
{
baseMethod(srvOrdGraph, apptGraph, header, details);
var subservice = (PXStringState)Base.OpportunityCurrent.Cache.GetValueExt(Base.OpportunityCurrent.Current, "SUBSERVICE_Attributes");
srvOrdGraph.CurrentServiceOrder.Cache.SetValueExt(srvOrdGraph.CurrentServiceOrder.Current, "SUBSERVICE_Attributes", subservice.Value);
}
#endregion
}
}
I can see that I am able to access the opportunity attribute when I debug, but it cannot find the attribute field on the service order to set the value. If I change the field to be “AttributeSUBSERVICE” and test it as a UDF, it works great.
Is there any way to make it work on the attribute tab or am I limited to only using the attribute as a UDF?
Thanks,
Drew