Correct way to get shipstate for transaction using...
# ask-stanley-ai
s
Correct way to get shipstate for transaction using suiteql
c
AI generated answer (using internal Slack threads):
To get the shipstate for a transaction using SuiteQL, you can use the
Transaction.ShippingAddress
field in your SuiteQL query. This field contains the shipping address details for the transaction, including the shipstate. Here is a sample SuiteQL query that includes the
Transaction.ShippingAddress
field:
Copy code
sql
SELECT
    Transaction.ID,
    Transaction.TranID AS ItemFullfillmentID,
    Transaction.TranDate AS FulfillmentDate,
    Transaction.Entity AS CustomerID,
    BUILTIN.DF( Transaction.Entity ) AS CustomerName,
    SalesOrder.TranID AS SalesOrderNumber,
    Transaction.OtherRefNum AS CustomerPONumber,
    BUILTIN.DF( Transaction.ShippingAddress ) AS ShipToAddress,
    REPLACE( BUILTIN.DF( Transaction.Status ), 'Item Fulfillment : ', '' ) AS Status,
FROM
    Transaction
    INNER JOIN TransactionLine ON
        ( TransactionLine.Transaction = Transaction.ID )
        AND ( TransactionLine.MainLine = 'T' )
    INNER JOIN Transaction AS SalesOrder ON
        ( SalesOrder.ID = TransactionLine.CreatedFrom )
WHERE
    ( Transaction.Type = 'ItemShip' )
    AND ( Transaction.TranDate >= TO_DATE( '2021-09-01', 'YYYY-MM-DD' ) )
    AND ( Transaction.Void = 'F' )
Please note that the
Transaction.ShippingAddress
field returns the entire shipping address as a string. If you need to extract the state from this string, you may need to do some additional processing in your script. ****** 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.802124679
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799924612
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799650252
Please provide your feedback on this answer.