Hi team,
Class - InventMovementQuantityValidator
private str buildMinQtyDialogStr(Qty _lowestQty, Qty _transQty) { str minQtyDialogStr = strFmt("@SCM:MinimumAllowedQuantityMessage", _transQty, _lowestQty); if (lowerLimitErrorCorrectionMethod == InventMovementQuantityErrorCorrectionMethod::PromptUser) { minQtyDialogStr = strFmt("@SCM:ReplaceQuantityMessage", _lowestQty); } return minQtyDialogStr; }
I like to put if condtion on method buildMinQtyDialogStr
If the parameter is set to YES then I like to skip above method else it should work as standard behaviour.
Kindly let me know how will approch this.
thanks!
Hi Mohit,
I go through the code and found you have added few new piece of code.
Kindly let me know what is does? and why it is required?
protected Qty resolveLowerLimitConflict(Qty _requestedQuantity, UnitOfMeasureSymbol _requestedUnitId)
{
boolean isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled;
if (isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal)
{
isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled = false;
}
next resolveLowerLimitConflict(_requestedQuantity, _requestedUnitId);
if (isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal && !isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled)
{
isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal;
}
Qty acceptableQuantity = _requestedQuantity;
InventMovementQuantityValidatorDialogsContext dialogContext = InventMovementQuantityValidatorDialogsContext::current();
boolean skipLowerLimitConflictCheck = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled && dialogContext && dialogContext.parmIsLowerLimitDialogPrompted();
Kindly elaborate pls
If I understood you requirement correctly, Then it should be straight forward, the code I shared will by pass the standard code always.. That's why I copied all standard code of resolveLowerLimitConflict method after next statement. now, you can add one more condition to check the parameter. Check my code and see I have written YourCustomParameter, you can replace it with PurchParameters (your field).
Let me know if still not clear.
PurchParameters
We can do like this.
purchParameters = PurchParametes::find();
In which table is your parameter? Can you access it in resolveLowerLimitConflict or buildMinQtyDialogStr method?
Yes Mohit,
If yes, then skip the standard
If no, then call standard
That I mentioned
You mentioned that your requirement is 'If the parameter is set to YES then I like to skip above method else it should work as standard behaviour.' Anyways, I have provided your a way to manipulate standard code, you can try it for changing quantity.
My requirement is to
If the parameter is set to Yes then while creating a PO add lines the qty should be always 0. User can later modify it .
If parameter is set to NO, then the qty should work like standard behaviour.
The method "buildMinQtyDialogStr" is called inside "resolveLowerLimitConflict".
//see whether you can bypass this if condition. Check in which method lowestQtyRequestedUnit or _requestedQantity value is assigned. Try to extend that method and write COC to change the value according to the parameter. if (lowestQtyRequestedUnit > _requestedQuantity) { str minQtyDialogStr = this.buildMinQtyDialogStr(lowestQtyRequestedUnit, _requestedQuantity); if (this.mustCorrectQty(lowerLimitErrorCorrectionMethod, minQtyDialogStr)) { acceptableQuantity = lowestQtyRequestedUnit; } }
I am not familiar with this functionality but you need to check while byepassing it does effects the standard functionality.
If none of them works you need to duplicate that class with your custom code and call that class where it is called.
Thanks,
Girish S.
You can manipulate isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled value to skip the standard method. Create extension class for InventMovementQuantityValidator and try adding below code
protected Qty resolveLowerLimitConflict(Qty _requestedQuantity, UnitOfMeasureSymbol _requestedUnitId) { boolean isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled; if (isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal) { isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled = false; } next resolveLowerLimitConflict(_requestedQuantity, _requestedUnitId); if (isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal && !isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled) { isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabledLocal; } Qty acceptableQuantity = _requestedQuantity; InventMovementQuantityValidatorDialogsContext dialogContext = InventMovementQuantityValidatorDialogsContext::current(); boolean skipLowerLimitConflictCheck = isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled && dialogContext && dialogContext.parmIsLowerLimitDialogPrompted(); if (this.isCheckNeeded(lowerLimitErrorCorrectionMethod) && !skipLowerLimitConflictCheck) { Qty lowestQtyModuleUnit = inventItemOrderSetupMap.lowestQty(); if (lowestQtyModuleUnit != 0) { Qty lowestQtyRequestedUnit = this.convertQty(lowestQtyModuleUnit, this.moduleUnitId(), _requestedUnitId); lowestQtyRequestedUnit = decRound(lowestQtyRequestedUnit, UnitOfMeasure::unitOfMeasureDecimalPrecision(UnitOfMeasure::unitOfMeasureIdBySymbol(_requestedUnitId))); //Add your parameter to skip this.buildMinQtyDialogStr if (lowestQtyRequestedUnit > _requestedQuantity) { if (YourCustomParameter) { str minQtyDialogStr = this.buildMinQtyDialogStr(lowestQtyRequestedUnit, _requestedQuantity); } if (this.mustCorrectQty(lowerLimitErrorCorrectionMethod, minQtyDialogStr)) { acceptableQuantity = lowestQtyRequestedUnit; } if (dialogContext && isInventMovementQuantityValidatorNoRepeatDialogsFlightEnabled) { dialogContext.parmIsLowerLimitDialogPrompted(true); } } } } return acceptableQuantity; }
Hi Mohit and Girish,
Both messages need to skip while adding new line in PO. if the parameter is set to YES.
else
It should work as it is.
As you said, COC not supported private method then how to skip both messages?
Kindly guide me pls
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156