Does anybody know how to get the Credit Memo item ...
# suitescript
r
Does anybody know how to get the Credit Memo item line description that is applied to an Invoice via search? I can get it if the Credit Memo has multiple line items, but there will be cases where it might have only 1 line item. The search will be executed via a script, and the only available info is the internal id of the Invoice. The search filter I used is
["appliedtotransaction","anyof",arrInvIds]
. I tried the following as the search results column but had no luck:
Copy code
search.createColumn({
         name: "internalid",
         join: "appliedToTransaction"
      }),
      search.createColumn({
         name: "memo",
         join: "appliedToTransaction"
      }),
      search.createColumn({
         name: "tranid",
         join: "applyingTransaction"
      }),
      search.createColumn({
         name: "memo",
         join: "applyingTransaction"
      }),
      search.createColumn({
         name: "tranid",
         join: "payingTransaction"
      }),
      search.createColumn({
         name: "memo",
         join: "payingTransaction"
      }),
      search.createColumn({
         name: "tranid",
         join: "billingTransaction"
      }),
      search.createColumn({
         name: "memo",
         join: "billingTransaction"
      })
b
this looks like you are trying to do a credit memo search
in which case the description would be the memo on the credit memo
not the joins
r
This is an invoice search but will try credit memo
No luck with doing a credit memo search, the memo is still empty
b
what does the code look like
r
Here is the search, I have hard coded the invoice internal id for now for testing purposes
Copy code
var transactionSearchObj = search.create({
   type: "transaction",
   filters:
   [
      ["appliedtotransaction","anyof","195468"], 
      "AND", 
      ["type","anyof","CustCred","CustPymt"]
   ],
   columns:
   [
      "internalid",
      "entity",
      "trandate",
      "tranid",
      "memo",
      "recordtype",
      "amount",
      search.createColumn({
         name: "trandate",
         join: "appliedToTransaction"
      }),
      search.createColumn({
         name: "tranid",
         join: "appliedToTransaction"
      }),
      search.createColumn({
         name: "internalid",
         join: "appliedToTransaction"
      }),
      search.createColumn({
         name: "recordtype",
         join: "appliedToTransaction"
      })
   ]
});
b
Works for me. The memo from the results match the item description on the credit memo
r
Try with only 1 line item on the credit memo
It also works if the credit memo has multiple lines for me
b
thats #22
r
Were these credit memo standalone Credit Memo, meaning not created by clicking on the Credit button on the Invoice
b
they are created from the invoice
which is why they fit the applied to filter
r
Do you mean that my issue is because it is standlone credit memo but applied to the invoice?
My credit memo does not have the
Created From
field populated
b
a credit memo that is applied to an invoice as a payment isnt linked to its line items
its linked at the header level
which means no access to line items
r
I see so that is basically my issue, no way to get via search then. Thanks, now I know there is nothing wrong with my search.
b
you can do searches
one to get the ids of the credit memos, the other to get the lines
alternatively a query
r
Thanks will explore your suggestions