when calling record.transform for a transfer orde...
# suitescript
s
when calling record.transform for a transfer order to an item receipt and I have multiple item fulfillment how can i make sure it will create item receipt for both like in the UI
b
You can specify item fulfillment in the defaultValues, I’ve not tried multiple but that is the first thing I would try
s
im trying to copy the receive button in the UI
b
For example, defaultValues: { itemfulfillment: [item fulfillment id] }
s
Copy code
var transformRecordPromise = record.transform.promise({
        fromType: "transferorder",
        fromId: transferorder.id,
        toType: "itemreceipt",
        defaultValues: {},
      });
I don't have all the item fulfilments
b
Create a search to find them?
s
that will slow down the script
b
I don’t know any other way to do what your asking, maybe brighter minds will jump in
s
@battk right now the script is executed on the item fulfillment
when the user clicks a cutom button
if need be i can move it to the transfer order if that helps
b
you should have the internal id of the fulfillment you are interested in if you are scripting on an item fulfillment
s
yes that I have but I want to receive all of them
like the UI
I can send the user to the transfer order page and then
just to clarify
Copy code
var transformRecordPromise = record.transform.promise({
        fromType: "transferorder",
        fromId: transferorder.id,
        toType: "itemreceipt",
        defaultValues: {},
      });
@battk how can you check if the current item fulfillment was received . check the trasnfer order wont help
b
a search or query
both have ways of getting related transactions through joins
s
and is that what happens when the user click recive ?
this is beyond my understanding I have the transfer order record loaded and the itemfuilment load but somehow need ot do some search to see if that item fulfillment was received ???
b
what do you get when you press the receive button where there are multiple item fulfillments for your order?
s
message has been deleted
b
you need to do the same thing if you want to receive all those fulfillments
make a list of fulfillments that can be received
you will have a hard time doing this using the record module, it doesn't track that information
so you have to use the query or search modules
s
so even if I just want to check if the current fulfillment is received so I don't get error on record.transform
b
i dont think you have any other tool
you can double check, but i dont think that information is stored on data accessible to any of those records that you might have access to
s
@battk i was doing a record.transform to a trasnfer order that new product was added and then fufiled but got this error
Copy code
>>ALERT:You must enter at least one line item for this transaction.