Hi,
I have added the below dropdown in the customer location screen(AR303020) and the dropdown should have the sales Rep names from Salesperson screen.
can someone help how to write the code for this.
Best answer by aaghaei
View originalHi,
I have added the below dropdown in the customer location screen(AR303020) and the dropdown should have the sales Rep names from Salesperson screen.
can someone help how to write the code for this.
Best answer by aaghaei
View originalYour DAC extension field should look something like this:
#region UsrSalesPersonID
public abstract class usrSalesPersonID : PX.Data.BQL.BqlInt.Field<usrSalesPersonID> { }
protected Int32? _UsrSalesPersonID;
[SalesPerson(DescriptionField = typeof(SalesPerson.descr))]
public virtual Int32? UsrSalesPersonID
{
get
{
return this._UsrSalesPersonID;
}
set
{
this._UsrSalesPersonID = value;
}
}
#endregion
Dropdowns are suggested when you have a fixed number of values that don’t change. When you have a dynamic list you will need to use a selector control as
<Table TableName="Location">
<Column TableName="Location" ColumnName="UsrSalesPersonID" ColumnType="int" AllowNull="True" DecimalPrecision="0" DecimalLength="0" IsNewColumn="True" IsUnicode="True" />
</Table>
using PX.Data;
using PX.Objects.AR;
using PX.Objects.CR;
namespace PX.Objects.CR
{
public sealed class MyCRLocationExt : PXCacheExtension<PX.Objects.CR.Location>
{
public static bool IsActive() => true;
#region UsrSalesPersonID
public abstract class usrSalesPersonID : PX.Data.BQL.BqlInt.Field<usrSalesPersonID> { }
[SalesPerson(DisplayName = "Sales Rep.", Required = true, Enabled = true, Visible = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Null)]
public int? UsrSalesPersonID { get; set; }
#endregion
}
}
<px:PXSegmentMask runat="server" ID="CstPXSegmentMask1" DataField="UsrSalesPersonID" />
thankyouso much @aaghaei, its working fine.
and i want to add one more column to Customer location Screen.
This is Preferred Tech (same Selector) from the Customers screen (AR303000) and pull the data from Attributes Tab .
I have added the CUstom Int field, added to the screen , DO i need to follow the same?
Do i need to add the PX.Objects.CS.CSAnswers anywhere?
#region UsrPreferredTech
public abstract class UsrPreferredTech : PX.Data.BQL.BqlInt.Field<UsrPreferredTech> { }
[CSAnswers(DisplayName = "PreferredTech", Required = true, Enabled = true, Visible = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Null)]
public int? UsrPreferredTech { get; set; }
#endregion
kindly correct me if am wrong.
Preview looks lik this.
And my code is,
using PX.Data.ReferentialIntegrity.Attributes;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CR.MassProcess;
using PX.Objects.CR.Workflows;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PO;
using PX.Objects.SO;
using PX.Objects.TX;
using PX.Objects;
using System.Collections.Generic;
using System;
using PX.Data.BQL.Fluent;
using PX.Data.BQL;
namespace PX.Objects.CR
{
public sealed class LocationExt : PXCacheExtension<PX.Objects.CR.Location>
{
public static bool IsActive() => true;
#region UsrPreferredTech
[PXDBInt]
[PXUIField(DisplayName="Preferred Tech")]
public int? UsrPreferredTech { get; set; }
public abstract class usrPreferredTech : PX.Data.BQL.BqlInt.Field<usrPreferredTech> { }
#endregion
#region UsrSalesRep
public abstract class UsrSalesRep : PX.Data.BQL.BqlInt.Field<UsrSalesRep> { }
[SalesPerson(DisplayName = "Sales Rep.", Required = true, Enabled = true, Visible = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Null)]
public int? UsrSalesPersonID { get; set; }
#endregion
#region UsrAcquisitionDate
[PXDBDate]
[PXUIField(DisplayName="Acquisition Date")]
public DateTime? UsrAcquisitionDate { get; set; }
public abstract class usrAcquisitionDate : PX.Data.BQL.BqlDateTime.Field<usrAcquisitionDate> { }
#endregion
}
}
please do the needful.
I suggest create a new question that other more experienced community members also have a look as usually they don’t look into the posts with lengthy threads and multiple issues/questions. If you like, tag me as well and I will try to have a look this weekend or overnight.
Also please provide the info about the Attributes (ID, Name, Type, …) preferably screenshots from “Attributes” screen itself and Customer attributes tab.
Thanks for your response
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.