How can I make a SuiteQL query that finds the tran...
# ask-stanley-ai
j
How can I make a SuiteQL query that finds the tranid of the transaction that a Purchase Order is created from?
c
AI generated answer (using internal Slack threads):
To find the tranid of the transaction that a Purchase Order is created from, you can use SuiteQL to query the
createdFrom
field on the Purchase Order record. This field contains the internal id of the transaction that the Purchase Order was created from. Here is a sample SuiteQL query that you can use as a starting point:
Copy code
sql
SELECT T.id, T.tranid, T.createdFrom 
FROM Transaction T 
WHERE T.type = 'PurchOrd'
In this query,
T.id
is the internal id of the Purchase Order,
T.tranid
is the transaction id of the Purchase Order, and
T.createdFrom
is the internal id of the transaction that the Purchase Order was created from. Please note that this query will return the internal id of the
createdFrom
transaction, not the tranid. If you need the tranid of the
createdFrom
transaction, you will need to join with the Transaction table again on the
createdFrom
field. ****** 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.851318359
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840759277
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837402344
Please provide your feedback on this answer.