using suiteQL how do I join the createdfrom transa...
# ask-stanley-ai
m
using suiteQL how do I join the createdfrom transaction when I query a return authorization?
c
AI generated answer (using internal Slack threads):
In order to join the
createdfrom
transaction when you query a return authorization using SuiteQL, you can use the
TransactionLine
table. The
TransactionLine
table has a
createdfrom
field which links to the transaction that created the current transaction. Here is an example of how you can do this:
Copy code
SQL
SELECT 
    ReturnAuth.ID,
    ReturnAuth.TranID AS ReturnAuthNumber,
    ReturnAuth.TranDate AS ReturnAuthDate,
    SalesOrder.TranID AS SalesOrderNumber
FROM 
    Transaction AS ReturnAuth
    INNER JOIN TransactionLine ON
        (TransactionLine.Transaction = ReturnAuth.ID)
    INNER JOIN Transaction AS SalesOrder ON
        (SalesOrder.ID = TransactionLine.CreatedFrom)
WHERE 
    (ReturnAuth.Type = 'RtnAuth')
In this query,
ReturnAuth
is the return authorization transaction, and
SalesOrder
is the transaction that the return authorization was created from. The
TransactionLine
table is used to link these two transactions together. Please note that this is a simplified example and you may need to adjust it based on your specific needs. For example, you may need to add additional fields to the SELECT clause, or additional conditions to the WHERE clause. ****** 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.818572521
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807988644
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807349205
Please provide your feedback on this answer.