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.
HI
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
Hi
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.
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
Hi
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
Hi
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
Hi
Thank you for your help. Could you explain the advantage of using Search<>
in the PXSelector
attribute?
You should also consider adding a UsrOrderType field because the primary key for SOOrder is OrderType and OrderNbr.
Hi
Thank you for pointing that out. I'll incorporate that into the customization.
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
Hi
Thank you. I really appreciate the explanation and the example you provided.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.