Solved

Get values from Custom Form to appear on Line Level according to Item and Customer in Sales Order Form

  • 20 July 2021
  • 7 replies
  • 44 views

Made a custom form with Item, Customer and Packaging Option.

I need to have a line level field in the Sales Order form called packaging option which has the given packaging option for that item and customer, how can I achieve this customization?

packaging option which is linked to custom form’s item, customer and packaging option

 

icon

Best answer by Naveen B 20 July 2021, 08:15

Okay... I understood.

  • Create a new Textbox Field in SOLine level - Read Only field
  •  Please write a “Inventory ID field updated” event, and based on the Inventory ID fetch the “Packaging Option” from your custom table and assign this value to the newly created field.

View original

7 replies

Userlevel 6
Badge +8

Hi @TharidhiP Please find the code below for Multi Checkbox

 

  protected virtual void DACName_FieldName_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
        {
            DACName row = e.Row as DACName;
            List<string> ItemClassLabels = new List<string>();
            List<string> ItemClassValues = new List<string>();
            foreach (INItemClass item in PXSelectReadonly<INItemClass>.Select(this))
            {
                ItemClassValues.Add(item.ItemClassID.ToString());
                ItemClassLabels.Add(item.ItemClassCD.Trim().ToString());
            }
            e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 10, true,
                typeof(DACName.FieldName).Name, false, -1, string.Empty, ItemClassValues.ToArray(), ItemClassLabels.ToArray(), false, null);
            ((PXStringState)e.ReturnState).MultiSelect = true;
        }

 

Userlevel 6
Badge +8

@TharidhiP Please ignore the above comment.

Userlevel 6
Badge +8

@TharidhiP  You wanted to load the Packaging Option dropdown from custom screen, based on the selection of an item ?

If yes, please write a “InventoryID field updated” event, and based on the Inventory ID fetch the “Packaging Option” from your custom table.

 

Hi @Naveen B , the requirement is that whatever packaging option selected in the custom form for the given item and customer should come in the packaging option line level field in SO form. No dropdown field required, just the specific option.

Userlevel 6
Badge +8

Okay... I understood.

  • Create a new Textbox Field in SOLine level - Read Only field
  •  Please write a “Inventory ID field updated” event, and based on the Inventory ID fetch the “Packaging Option” from your custom table and assign this value to the newly created field.

protected void SOLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
SOLine row = (SOLine)e.Row;

if (row == null) return;
PKCFPackagingOption pkgOption = PXSelect<PKCFPackagingOption,
Where<PKCFPackagingOption.item,
Equal<Required<PKCFPackagingOption.item>>>>.Select(Base, row.inventoryID);
var rowExt = PXCache<SOLine>.GetExtension<SOLineExt>(row);
if(rowExt != null ){
rowExt.usrPackagingOptionFromCF = pkgOption.packagingOption;
}
}

Attempted this approach, what are the corrections to be done? @Naveen B

Userlevel 6
Badge +8

Hi @TharidhiP This should work.. any issue you are facing with this code?

Are you getting the values in pkgOption object?

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved