Here I have quantity 2 and when I ship /invoice 1 quantity, I should only return sales order for remaining two quantity,
In my field when I enter quantity 2 or more i should get error,
Because I have only one quantity left so I should send return for that, i have done validation for more that 2 quantity, but need for quantity Shipped and remaining quantity only need to send, please need help in this part.
This is my code:
trigger OnValidate()
var
cu_ItemVatCalculation: Codeunit ItemVatCalculation;
rec_Item: Record Item;
itemVat: Decimal;
rec_SalesLine: Record "Sales Line";
enum_DocumentType: Enum "Sales Document Type";
begin
Rec.VAT := Rec."Unit Price" * Rec."Return/Replace";
if (Rec."Return/Replace" > rec.Quantity) or (Rec."Return/Replace" < 0) then begin Error('Please provide valid Return/Replace quantity');
end;
Hi Shankar,
Based on your code, an error will only be triggered if the return/replace quantity more than original quantity. As your original quantity is 2 and you have already shipped 1, entering 2 in the return/replace field will not get an error.
for that you should set the return/replace quantity to be greater than shipped quantity, as suggested by Kaspars..
Rec."Return/Replace" > Rec."Quantity Shipped"
Regards
Then adjust this place:
if (Rec."Return/Replace" > rec.Quantity) or (Rec."Return/Replace" < 0)
Change Quantity to Shipped Quantity
I need to compare ship quantity , if my ship quantity is 1 and I enter 1 in my return replace field, i should not get error ,but if I enter more than 1 in return replace field then I should get error,
So how to do that in al/code
Please help.
I am not a Developer, but from what I can see Your quantity is 2, and in the Return/Replace You also Enter 2.
Error is given only when Return/Replace is higher than Quantiy or below 0.
So adjust Your code there. I guess You need to compare the Shipped Quantity not Quantity.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156