Skip to main content
Answer

Any option to Load Salesperson based on Login User.?

  • November 11, 2021
  • 1 reply
  • 299 views

bigil
Freshman II
Forum|alt.badge.img

When we create a sales order,  is there any option to load the Salesperson based on Login User Employee instead of loading based on customer .( User is linked with Employee and employee is linked with Salesperson) .

Any suggestions ?

 

Thanks in advance.

 

 

Best answer by markusray17

This would require a customization although a fairly simple one.

On the SOOrder DAC

The base attribute for the default salesperson

[PXDefault(typeof(Search<CustDefSalesPeople.salesPersonID, Where<CustDefSalesPeople.bAccountID, Equal<Current<SOOrder.customerID>>, And<CustDefSalesPeople.locationID, Equal<Current<SOOrder.customerLocationID>>, And<CustDefSalesPeople.isDefault, Equal<True>>>>>), PersistingCheck = PXPersistingCheck.Nothing)]

You would just override this with something like

[PXDefault(typeof(Search<EPEmployee.salesPersonID, Where<EPEmployee.userID, Equal<Current<AccessInfo.userID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]

Current<AccessInfo.userID> should give you the current userID which you can use to find the employee record of the current user and that should have the salesPersonID on there. 

1 reply

Forum|alt.badge.img+5
  • Jr Varsity II
  • Answer
  • November 16, 2021

This would require a customization although a fairly simple one.

On the SOOrder DAC

The base attribute for the default salesperson

[PXDefault(typeof(Search<CustDefSalesPeople.salesPersonID, Where<CustDefSalesPeople.bAccountID, Equal<Current<SOOrder.customerID>>, And<CustDefSalesPeople.locationID, Equal<Current<SOOrder.customerLocationID>>, And<CustDefSalesPeople.isDefault, Equal<True>>>>>), PersistingCheck = PXPersistingCheck.Nothing)]

You would just override this with something like

[PXDefault(typeof(Search<EPEmployee.salesPersonID, Where<EPEmployee.userID, Equal<Current<AccessInfo.userID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]

Current<AccessInfo.userID> should give you the current userID which you can use to find the employee record of the current user and that should have the salesPersonID on there.