How to get pnrefnum using Suiteql?
# ask-stanley-ai
j
How to get pnrefnum using Suiteql?
c
AI generated answer (using internal Slack threads):
To get the
pnrefnum
using SuiteQL, you can use the
PreviousTransactionLink
table. This table links transactions together, and you can use it to get the
pnrefnum
from the Sales Order linked to the Item Fulfillment. Here is a rough example of how you might structure your SuiteQL query:
Copy code
sql
SELECT
    Transaction.type,
    Transaction.trandate,
    Transaction.number,
    Transaction.shippingaddress,
    TransactionLine.item,
    TransactionLine.quantity
FROM
    PreviousTransactionLink
    INNER JOIN Transaction ON 
        (Transaction.ID = PreviousTransactionLink.nextdoc)
    INNER JOIN Transactionline ON 
        (Transactionline.transaction = Transaction.id)
WHERE
    PreviousTransactionLink.previousdoc = YOUR_DOCUMENT_ID
    AND PreviousTransactionLink.linktype = 'ShipRcpt'
In this query, replace
YOUR_DOCUMENT_ID
with the ID of the document you're interested in. The
linktype
of 'ShipRcpt' is used to link Item Fulfillments to Sales Orders. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811465
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.798990369
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.796767652
Please provide your feedback on this answer.