Hello Everyone,
We have a requirement where we are using Manufacturing module and trying to map options from "Configuration Entry" pop-up through code but while doing getting unexpected errors like: “Move Next” etc.
Sharing our requirement and sample code for your review and feedback, please find details below:
Requirement:
- Created a Configuration ID on Configuration Maintenance screen
- Used that record on Sales Order screen under Details tab.
- Now on Sales Order Save action based on some custom condition we want to check include checkbox, then execute save action on pop-up and then execute FINISH button, available on pop-up.
- As per below screenshot we want to mark Included checkbox true under OPTION tab for each feature: Pattern, Grove, Doors, Jamb through code.
Sample Code:
public class KNBCSOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public static bool IsActive() { return true; }
#region Persist Override
public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate del)
{
del();
//COLOR:RED | DIMENSION:24x36 | DRNHOLES:YES | DOOR:Solid Core
ConfigurationEntry configGraph = PXGraph.CreateInstance<ConfigurationEntry>();
foreach (SOLine line in Base.Transactions.Select())
{
foreach (AMConfigResultsOption option in PXSelectJoin<AMConfigResultsOption,
InnerJoin<AMConfiguration, On<AMConfiguration.configurationID, Equal<AMConfigResultsOption.configurationID>>>,
Where<AMConfiguration.inventoryID, Equal<Required<AMConfiguration.inventoryID>>>>
.Select(Base, line.InventoryID))
{
configGraph.Options.Update(option); // causing Move Next Error
configGraph.Options.Current = option; // causing Move Next Error
if (configGraph.Options.Current != null)
{
configGraph.Options.Current.Included = true;
configGraph.Options.Update(configGraph.Options.Current);
}
//Skipped above code piece and tried below
option.Included = true;
configGraph.Options.Update(option); // causing Move Next Error
}
}
configGraph.Actions.PressSave();
}
#endregion
}
Can anyone suggest best possible way to achieve this please.
Thank you in advance !
Best answer by vivekm
View original