Skip to main content
Solved

Customization to Change default value for move

  • February 25, 2025
  • 4 replies
  • 44 views

Forum|alt.badge.img

I am trying to change the default lookup value for a field. I am wanting to make the “Operation ID” default to the last value instead of the first. screenshot below. I thought it might be as simple as changing the order of the Dac from asc to desc (screenshot below) but that didnt seem to do anything.. i tried doing that in the customized data classes screen and with a graph extension but neither seemed to work. Can someone point me in the direction of where to change this at? I also tried looking at the business logic and only found where it specified to retrieve the data but not the default value. I am still learning the acumatica framework, so any help would be greatly appreciated.

 

Best answer by Samvel Petrosov

It looks like there is another defaulting logic on that page that works when the Production Nbr field is assigned a value.

This is in PX.Objects.AM.MoveEntryBase<TWhere>

protected virtual void AMMTran_ProdOrdID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
		{
			AMMTran ammTran = (AMMTran)e.Row;
			if (string.IsNullOrWhiteSpace((ammTran != null) ? ammTran.ProdOrdID : null))
			{
				return;
			}
			if (this.ampsetup.Current == null)
			{
				this.ampsetup.Current = PXSelectBase<AMPSetup, PXSelect<AMPSetup>.Config>.Select(this, Array.Empty<object>());
			}
			AMProdItem amproditem = (AMProdItem)PXSelectorAttribute.Select<AMMTran.prodOrdID>(sender, ammTran);
			if (amproditem == null)
			{
				return;
			}
			int? firstOperationID = amproditem.FirstOperationID;
			int? lastOperationID = amproditem.LastOperationID;
			bool singleOpeation = firstOperationID.GetValueOrDefault() == lastOperationID.GetValueOrDefault() & firstOperationID != null == (lastOperationID != null);
			bool flag = this.IsImport || this.IsContractBasedAPI;
			if (flag && singleOpeation)
			{
				sender.SetValueExt<AMMTran.operationID>(ammTran, amproditem.LastOperationID);
			}
			if (!flag)
			{
				AMProdOper oper = this.ampsetup.Current.InclScrap.GetValueOrDefault() ? PXSelectBase<AMProdOper, PXSelectJoin<AMProdOper, InnerJoin<AMProdItem, On<AMProdOper.orderType, Equal<AMProdItem.orderType>, And<AMProdOper.prodOrdID, Equal<AMProdItem.prodOrdID>>>>, Where<AMProdOper.orderType, Equal<Required<AMProdOper.orderType>>, And<AMProdOper.prodOrdID, Equal<Required<AMProdOper.prodOrdID>>, And<Sub<AMProdItem.qtytoProd, Add<AMProdOper.qtyComplete, AMProdOper.qtyScrapped>>, Greater<decimal0>>>>, OrderBy<Asc<AMProdOper.operationCD>>>.Config>.SelectWindowed(this, 0, 1, new object[]
				{
					ammTran.OrderType,
					ammTran.ProdOrdID
				}) : PXSelectBase<AMProdOper, PXSelectJoin<AMProdOper, InnerJoin<AMProdItem, On<AMProdOper.orderType, Equal<AMProdItem.orderType>, And<AMProdOper.prodOrdID, Equal<AMProdItem.prodOrdID>>>>, Where<AMProdOper.orderType, Equal<Required<AMProdOper.orderType>>, And<AMProdOper.prodOrdID, Equal<Required<AMProdOper.prodOrdID>>, And<Sub<AMProdItem.qtytoProd, AMProdOper.qtyComplete>, Greater<decimal0>>>>, OrderBy<Asc<AMProdOper.operationCD>>>.Config>.SelectWindowed(this, 0, 1, new object[]
				{
					ammTran.OrderType,
					ammTran.ProdOrdID
				});
				if (oper != null && oper.OperationID != null)
				{
					sender.SetValueExt<AMMTran.operationID>(ammTran, oper.OperationID);
				}
				else if (ammTran.OperationID == null)
				{
					sender.SetValueExt<AMMTran.operationID>(ammTran, amproditem.FirstOperationID);
				}
			}
			sender.SetValueExt<AMMTran.inventoryID>(ammTran, amproditem.InventoryID);
			sender.SetValueExt<AMMTran.subItemID>(ammTran, amproditem.SubItemID);
			sender.SetValueExt<AMMTran.siteID>(ammTran, amproditem.SiteID);
			sender.SetValueExt<AMMTran.locationID>(ammTran, amproditem.LocationID);
			sender.SetValueExt<AMMTran.uOM>(ammTran, amproditem.UOM);
			sender.SetValue<AMMTran.wIPAcctID>(ammTran, amproditem.WIPAcctID);
			sender.SetValue<AMMTran.wIPSubID>(ammTran, amproditem.WIPSubID);
			this.SyncTransactionAttributes(ammTran);
		}

 

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img
  • Jr Varsity I
  • 48 replies
  • February 25, 2025

Hi @justen0351,

You are adding the description to the OperationCD field, but I believe you need to use the OperationID field instead.

Please try replacing OperationCD with OperationID.

Hope, it helps!


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 14 replies
  • February 25, 2025

@Ankita Tayana Thank you for the reponse. i tried changing it to operationID but it is still pulling the lowest operation id instead of the highest.

 


Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+3
  • Jr Varsity II
  • 100 replies
  • Answer
  • February 25, 2025

It looks like there is another defaulting logic on that page that works when the Production Nbr field is assigned a value.

This is in PX.Objects.AM.MoveEntryBase<TWhere>

protected virtual void AMMTran_ProdOrdID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
		{
			AMMTran ammTran = (AMMTran)e.Row;
			if (string.IsNullOrWhiteSpace((ammTran != null) ? ammTran.ProdOrdID : null))
			{
				return;
			}
			if (this.ampsetup.Current == null)
			{
				this.ampsetup.Current = PXSelectBase<AMPSetup, PXSelect<AMPSetup>.Config>.Select(this, Array.Empty<object>());
			}
			AMProdItem amproditem = (AMProdItem)PXSelectorAttribute.Select<AMMTran.prodOrdID>(sender, ammTran);
			if (amproditem == null)
			{
				return;
			}
			int? firstOperationID = amproditem.FirstOperationID;
			int? lastOperationID = amproditem.LastOperationID;
			bool singleOpeation = firstOperationID.GetValueOrDefault() == lastOperationID.GetValueOrDefault() & firstOperationID != null == (lastOperationID != null);
			bool flag = this.IsImport || this.IsContractBasedAPI;
			if (flag && singleOpeation)
			{
				sender.SetValueExt<AMMTran.operationID>(ammTran, amproditem.LastOperationID);
			}
			if (!flag)
			{
				AMProdOper oper = this.ampsetup.Current.InclScrap.GetValueOrDefault() ? PXSelectBase<AMProdOper, PXSelectJoin<AMProdOper, InnerJoin<AMProdItem, On<AMProdOper.orderType, Equal<AMProdItem.orderType>, And<AMProdOper.prodOrdID, Equal<AMProdItem.prodOrdID>>>>, Where<AMProdOper.orderType, Equal<Required<AMProdOper.orderType>>, And<AMProdOper.prodOrdID, Equal<Required<AMProdOper.prodOrdID>>, And<Sub<AMProdItem.qtytoProd, Add<AMProdOper.qtyComplete, AMProdOper.qtyScrapped>>, Greater<decimal0>>>>, OrderBy<Asc<AMProdOper.operationCD>>>.Config>.SelectWindowed(this, 0, 1, new object[]
				{
					ammTran.OrderType,
					ammTran.ProdOrdID
				}) : PXSelectBase<AMProdOper, PXSelectJoin<AMProdOper, InnerJoin<AMProdItem, On<AMProdOper.orderType, Equal<AMProdItem.orderType>, And<AMProdOper.prodOrdID, Equal<AMProdItem.prodOrdID>>>>, Where<AMProdOper.orderType, Equal<Required<AMProdOper.orderType>>, And<AMProdOper.prodOrdID, Equal<Required<AMProdOper.prodOrdID>>, And<Sub<AMProdItem.qtytoProd, AMProdOper.qtyComplete>, Greater<decimal0>>>>, OrderBy<Asc<AMProdOper.operationCD>>>.Config>.SelectWindowed(this, 0, 1, new object[]
				{
					ammTran.OrderType,
					ammTran.ProdOrdID
				});
				if (oper != null && oper.OperationID != null)
				{
					sender.SetValueExt<AMMTran.operationID>(ammTran, oper.OperationID);
				}
				else if (ammTran.OperationID == null)
				{
					sender.SetValueExt<AMMTran.operationID>(ammTran, amproditem.FirstOperationID);
				}
			}
			sender.SetValueExt<AMMTran.inventoryID>(ammTran, amproditem.InventoryID);
			sender.SetValueExt<AMMTran.subItemID>(ammTran, amproditem.SubItemID);
			sender.SetValueExt<AMMTran.siteID>(ammTran, amproditem.SiteID);
			sender.SetValueExt<AMMTran.locationID>(ammTran, amproditem.LocationID);
			sender.SetValueExt<AMMTran.uOM>(ammTran, amproditem.UOM);
			sender.SetValue<AMMTran.wIPAcctID>(ammTran, amproditem.WIPAcctID);
			sender.SetValue<AMMTran.wIPSubID>(ammTran, amproditem.WIPSubID);
			this.SyncTransactionAttributes(ammTran);
		}

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 14 replies
  • March 6, 2025

Thank you ​@Samvel Petrosov. I believe that points me in the right direction.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings