ANS-0538 · SUITESCRIPT DEVELOPMENT
How to Retrieve Gift Certificate Internal IDs from NetSuite Web Store Transactions
Discover the reliable method for identifying NetSuite Gift Certificate internal IDs within web store contexts for validation and display.
Short answer
To identify a Gift Certificate in NetSuite web store transactions, utilize the 'authcode' line item value. This value serves as a key identifier, which can be used to determine the Gift Certificate's internal ID. Once identified, SuiteScript 2.x functions like N/search.lookupFields can be employed to fetch additional details, such as the display authentication code, for further processing.
Scenario
Users often encounter challenges when attempting to retrieve specific Gift Certificate line item values, such as 'giftcertredemption' or 'authcode_display', directly from NetSuite web store transactions. These fields may not consistently populate or be directly accessible in the web store context, leading to difficulties in identifying the associated Gift Certificate for further processing or display.
Solution
While certain line item values like 'giftcertredemption' and 'authcode_display' may be accessible via the NetSuite UI, their direct availability or population within the web store context can vary or be limited. The 'authcode' line item value, however, is a consistent identifier for gift certificates, accessible through both the web store and NetSuite UI. This value can be used to identify the Gift Certificate's internal ID, which then allows for obtaining the authentication code display and performing further validations using SuiteScript 2.x methods. For example, to look up fields based on the Gift Certificate internal ID, the following SuiteScript 2.x approach can be used:
javascript
var giftCertInternalId = authcodeLineItemValue; // Assuming 'authcodeLineItemValue' is retrieved from the transaction line item
var giftCertFields = N/search.lookupFields({
type: N/record.Type.GIFTCERTIFICATE,
id: giftCertInternalId,
columns: ['authcode'] // 'authcode' here refers to the field on the Gift Certificate record for its display value
});
var authCodeDisplay = giftCertFields.authcode;Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
