Hey I want to make a check before transforming SO ...
# suitescript
t
Hey I want to make a check before transforming SO to Item Fulfillment so this does not occur "You must have at least one valid line item for this transaction". This occurs in case of all items have item fulfillment records (with all quantity) and none left to be in new IF. How can I do so ?
n
If you're transforming the record, you shouldn't see the message until you save the record so check the lines before you save.
a
There are a couple of ways to know if an SO is fulfillable. If you have the SO record loaded check for the following fields: orderstatus status statusRef
t
If you're transforming the record, you shouldn't see the message until you save the record so check the lines before you save.
That doesn't work had already done that.
This error comes just when the transform record is called. @NElliott
in the same line.
@Antonio Jr if I make an item fulfillment from SO, but its status of IF is picked only(not Fulfilled ), the status of sales order still remains Pending Fulfillment.
Now if you will transform the same record, again this will generate this error.
n
Oh, I stand corrected.
b
honestly by far easiest is to transform the record and catch the error
t
I have done the same 😄
for now
b
if you want to put in the work, you can check if any of the sales order items are committed
or if any of the fulfillable non inventory items have quantity greater than its quantity fulfilled
t
or if some new item is added in sales order
a
oh, you have pick pack ship 😅 I always transform with shipped status, I agree with @battk with the try catch
t
var x = nlapiGetOldRecord();
var y = nlapiGetLineItemCount("item");
var flag1 = true,
if ((x.getLineItemCount("item") == y)) {
for (var z = 1; z <= y; z++) {
flag1 = flag1 && (x.getLineItemValue("item", toConsider, z) == nlapiGetLineItemValue("item", toConsider, z));
}
}
if ((x.getLineItemCount("item") == y) && flag1) {
nlapiLogExecution("Debug", "Script Status", "Won't Run");
} else {
//Script code here}
Once i did something like this to check before transform when doing SO to RA toConsider is "quantityfulfilled"
that worked that time 😄 but here the case is a little bit different