alien4u
06/30/2021, 4:41 PMcreece
06/30/2021, 4:44 PMalien4u
06/30/2021, 4:45 PMN/query
?creece
06/30/2021, 4:48 PMcreece
06/30/2021, 4:48 PMGeneralKenobi
06/30/2021, 4:50 PMalien4u
06/30/2021, 4:53 PMalien4u
06/30/2021, 4:53 PMcreece
06/30/2021, 4:59 PMcreece
06/30/2021, 5:01 PMstalbert
06/30/2021, 5:02 PMalien4u
06/30/2021, 5:03 PMcreece
06/30/2021, 5:05 PMstalbert
06/30/2021, 5:08 PMconst
and template strings 🙂alien4u
06/30/2021, 5:19 PMtdietrich
06/30/2021, 7:13 PMalien4u
06/30/2021, 7:42 PMalien4u
06/30/2021, 7:43 PMtdietrich
06/30/2021, 7:57 PMtdietrich
06/30/2021, 7:57 PMjen
06/30/2021, 8:16 PMjen
06/30/2021, 8:16 PMSELECT DISTINCT
grandparent.id AS grandparent_id,
BUILTIN.DF(grandparent.type) AS grandparent_type,
grandparent.tranid AS grandparent_tranid,
parent.tranid AS parent_id,
BUILTIN.DF(parent.type) AS parent_type,
parent.tranid AS parent_tranid,
child.tranid AS child_id,
BUILTIN.DF(child.type) AS child_type,
child.tranid AS child_tranid
FROM transaction child
JOIN transactionline child_parent_tl ON (child.id = child_parent_tl.transaction)
JOIN transaction parent ON (child_parent_tl.createdfrom = parent.id)
JOIN transactionline parent_grandparent_tl ON (parent.id = parent_grandparent_tl.transaction)
JOIN transaction grandparent ON (parent_grandparent_tl.createdfrom = grandparent.id)
WHERE child.id = 360403
jen
06/30/2021, 8:16 PMjen
06/30/2021, 8:17 PMSELECT DISTINCT
grandparent.id AS grandparent_id,
BUILTIN.DF(grandparent.type) AS grandparent_type,
grandparent.tranid AS grandparent_tranid,
parent_grandparent_ptll.linktype AS grandparent_parent_linktype,
parent.tranid AS parent_id,
BUILTIN.DF(parent.type) AS parent_type,
parent.tranid AS parent_tranid,
child_parent_ptll.linktype AS child_parent_linktype,
child.tranid AS child_id,
BUILTIN.DF(child.type) AS child_type,
child.tranid AS child_tranid
FROM transaction child
JOIN PreviousTransactionLineLink child_parent_ptll ON (child.id = child_parent_ptll.NextDoc)
JOIN transaction parent ON (child_parent_ptll.PreviousDoc = parent.id)
JOIN PreviousTransactionLineLink parent_grandparent_ptll ON (parent.id = parent_grandparent_ptll.NextDoc)
JOIN transaction grandparent ON (parent_grandparent_ptll.PreviousDoc = grandparent.id)
WHERE child.id = 360403
jen
06/30/2021, 8:19 PMtdietrich
06/30/2021, 8:38 PMSELECT
Refund.TransactionNumber AS RefundTransactionNumber,
BUILTIN.DF( Refund.Entity ) AS CustomerName,
CustCredLink.NextDoc AS CustCredID,
BUILTIN.DF( CustCredLink.NextDoc ) AS CustCredTranID,
CustPymtLink.NextDoc AS CustPymtID,
BUILTIN.DF( CustPymtLink.NextDoc ) AS CustPymtTranID
FROM
Transaction AS Refund
LEFT OUTER JOIN PreviousTransactionLineLink AS CustCredLink ON
( CustCredLink.PreviousDoc = Refund.ID ) AND ( CustCredLink.NextType = 'CustCred' )
LEFT OUTER JOIN PreviousTransactionLineLink AS CustPymtLink ON
( CustPymtLink.PreviousDoc = Refund.ID ) AND ( CustPymtLink.NextType = 'CustPymt' )
WHERE
( Refund.ID = 2287936 )
So essentially, given the NetSuite ID for a refund, this will give you the Credit Memo that it originated from, and (if applicable) the payment that was made.tdietrich
06/30/2021, 8:39 PMtdietrich
06/30/2021, 8:39 PMbattk
06/30/2021, 8:39 PMalien4u
06/30/2021, 8:44 PMalien4u
06/30/2021, 8:44 PMbattk
06/30/2021, 9:25 PMbattk
06/30/2021, 9:26 PM