I need an urgent help. Can someone help in this, I...
# suitescript
s
I need an urgent help. Can someone help in this, I am need to apply invoice on credit memo and I am trying using a script but due to large number of open invoices around 10k. The below function not finding the index of invoice in apply list - credit_memo_record_obj.findSublistLineWithValue({ sublistId: 'apply', fieldId: 'internalid', value: invoice_record_id });
b
use the
invoices
default value to limit the invoices that appear on the apply sublist
e
How would someone know this exists?
b
there used to be better documentation in suitescript 1.0 docs
now i just direct people to the source of
nsapiInitRecords
💯 1
which is what used to be used to do the client side validation for the record related apis
s
@battk Are you saying that I should limit the records using customize button on the apply subtab? Could you please send me the link here to limit it.
b
learn how to use default values first
💯 1
the
entity
default value is a pretty good one to start out with since its widely supported
its also one you are likely to see in the urls of a record while working in the ui
which is where you would normally learn that default values also work in the ui as query parameters
which makes it easier to see the effect of the default values since you can see them in the ui instead of in script
s
I have already tried using default values, but it didn't work. I couldn't find any field for apply sublist to default on record load.
b
default values used to be called initialize values, which was probably a better name
they arent fields, they are parameters used to initialize a record with values
in the case of the entity default value, it sets the entity field and does all the entity related sourcing
in the case of the invoices default value, it limits the rows on the apply sublist
s
Copy code
In have tried this because I have already created credit memo and trying applying from apply sublist.
record.Load({
    type: record.Type.CREDIT_MEMO,
    isDynamic:true,
    defaultValues: {
        entity: 107
    }
});
b
thats not going to do anything useful
your credit memo already has an entity
stat with making a new one
s
so you mean, if I will try defaulting entity on credit memo creation and then I would be able to apply invoice without other setting?
b
again, it sounded like you dont know how default values work
which is why i suggested starting entity, its a fairly commonly used default value
then graduate to invoices after you figure out how the entity default value works
s
Apologies, I know it is used to initialize values, but not able to figure what parameter do I need to pass. Anyway thank you so much for your help. I appreciate it.
b
i told you up front, its the
invoices
default value
s
okay
You mean I need to pass invoices as parameter and its internal id. got it.
Sorry for the confusion.
Hey @battk It worked. I am so sorry for the confusion. I couldn't understand you initially. Thank you so much for your great help. It was a blocker of one of our project.