Hi Team,
I added two custom fields, one on the project screen and one on the quote screen. I want to transfer values when a project is created from a quote. The fields are using the DACs 'PMSiteAddress' and 'CRAddress'. For the 'PMSiteAddress', I've created an extension class 'CRAddressExt' to add a custom field 'usrCounty'. Similarly, for the 'PMAddress', I've created an extension class 'PMAddressExt' with the same custom field 'usrCounty'
public class CRAddressExt : PXCacheExtension<PX.Objects.CR.CRAddress>
{
#region UsrCounty
[PXDBString(155)] [PXUIField(DisplayName = "County")]
public virtual string UsrCounty { get; set; }
public abstract class usrCounty : PX.Data.BQL.BqlString.Field<usrCounty> { }
#endregion
}
for project
public class PMAddressExt : PXCacheExtension<PX.Objects.PM.PMAddress>
{
#region UsrCounty
[PXDBString(155)]
[PXUIField(DisplayName = "County")]
public virtual string UsrCounty { get; set; }
public abstract class usrCounty : PX.Data.BQL.BqlString.Field<usrCounty> { }
#endregion
}
I've written this code to transfer the value:
public class ProjectEntry_Extension : PXGraphExtension<PX.Objects.PM.ProjectEntry>
{ protected virtual void _(Events.RowSelected<PMSiteAddress> e)
{
var row = (PMSiteAddress)e.Row;
if (row == null) return;
CRAddress address = PXSelect<CRAddress, Where<CRAddress.lastModifiedByScreenID, Equal<Required<PMSiteAddress.lastModifiedByScreenID>>>> .Select(Base, row.LastModifiedByScreenID);
if (row != null && row.LastModifiedByScreenID == "PM304500")
{
var AddressExt = PXCache<CRAddress>.GetExtension<CRAddressExt>(address);
e.Cache.SetValue<PMAddressExt.usrCounty>(row, AddressExt?.UsrCounty);
}
}
}
in the ProjectEntry Graph However, the field value is not transferring. Do you have a solution for this, or am I making a mistake? Please advise.
Regards,
Sagar