Skip to main content
Answer

How to establish a connection between Sales Orders (SO301000) and Bills and Adjustments (AP301000) forms

  • September 10, 2024
  • 10 replies
  • 90 views

Forum|alt.badge.img

There is a new requirement to establish a connection between Sales Orders (SO301000) and Bills and Adjustments (AP301000). I attempted to add two custom fields for order type and order number in the Bills and Adjustments (AP301000) form to retrieve sales order types and sales order numbers in the database, allowing the user to select them. Using this new custom column, which stores the sales order numbers, we can establish the connection. However, this did not produce the intended result. Is this the correct approach to create a connection between these two forms? Any guidance or detailed steps on how to implement this would be greatly appreciated.

Best answer by aiwan

@RKarunarathne51 

 

By creating a new field UsrSOOrderNbr, you should be able to use a PXSelector to select the SO that relates to the bill. This also creates a Foreign Reference to the SOOrder table which will help with joining in GI’s etc.

You might need to set the field to enabled with RowSelected if you are amending bills which are already released.

 

Aleks

10 replies

Forum|alt.badge.img+8
  • Captain II
  • September 10, 2024

HI @RKarunarathne51 

 

Do you use the ‘Link PO’ feature for sales orders?

If so, you coud use a RowInserted event to set the SO nbr when the bill is created from the PO.

 

Aleks


Forum|alt.badge.img

Hi @aiwan ,
No, there are already existing bills that need to be connected to sales orders. Additionally, new bills should also be able to connect to sales orders. That's why I decided to choose that approach.


Forum|alt.badge.img+8
  • Captain II
  • Answer
  • September 10, 2024

@RKarunarathne51 

 

By creating a new field UsrSOOrderNbr, you should be able to use a PXSelector to select the SO that relates to the bill. This also creates a Foreign Reference to the SOOrder table which will help with joining in GI’s etc.

You might need to set the field to enabled with RowSelected if you are amending bills which are already released.

 

Aleks


Forum|alt.badge.img

Hi @aiwan,
This is my DAC extension. Is this correct?

#region UsrNewField
[PXDBString(15)]
[PXUIField(DisplayName = "Order ID")]
[PXSelector(typeof(Search<SOOrder.orderNbr>),
    typeof(SOOrder.orderDate),
    typeof(SOOrder.orderType))]

public virtual string UsrNewField { get; set; }
public abstract class usrNewField : PX.Data.BQL.BqlString.Field<usrNewField> { }
#endregion


Forum|alt.badge.img+8
  • Captain II
  • September 10, 2024

Hi @RKarunarathne51 

 

You can remove the search<>, it is not needed for what you want.

other than that, it is all good.

Remember to add a DB script to add the field to the database.

 

Aleks


Forum|alt.badge.img

Hi @aiwan ,
Thank you for your help. Could you explain the advantage of using Search<> in the PXSelector attribute?


Forum|alt.badge.img+7
  • Captain II
  • September 10, 2024

You should also consider adding a UsrOrderType field because the primary key for SOOrder is OrderType and OrderNbr.


Forum|alt.badge.img

Hi @Django  ,
Thank you for pointing that out. I'll incorporate that into the customization.


Forum|alt.badge.img+8
  • Captain II
  • September 11, 2024

@RKarunarathne51 

 

Search<> is mainly used when you have conditions that need satisfied e.g.

Search<SOOrder.orderNbr, Where<SOOrder.someBool,Equal<True>>>; 

This link should help too: Acumatica

 

Aleks


Forum|alt.badge.img

Hi @aiwan,
Thank you. I really appreciate the explanation and the example you provided.