Using Custom Fields to Access Locked or Bundle Fields in Templates

When working with transactions, you might encounter a situation where certain fields hold values from bundles or are otherwise locked. These fields cannot be directly referenced or used in templates, creating challenges when you need to display or utilize their values in documents, emails, or reports.

To work around this limitation, you can create custom fields and use formula fields to store the values of the locked or bundle fields. Once created, these custom fields can then be utilized in templates to display or process the required information.

Step 1: Identify the Locked Field

  1. Determine the field whose value you need to use in the template.
  2. Confirm that this field is locked or comes from a bundle and cannot be directly referenced.

Step 2: Create a Custom Field

  1. Navigate to Customization > Lists, Records, & Fields > Transaction Body/Line Fields.
  2. Click New to create a new custom field.
  3. Configure the custom field:
  • Label: Provide a descriptive name for the field (e.g., “Template-Compatible Field”).
  • Type: Choose the appropriate type (e.g., Text, Number, etc.) depending on the data in the locked field.
  • Applies To: Select the transaction types where this field should be available.

Step 3: Use a Formula Field to Store the Value

  1. In the custom field creation/edit screen, go to the Validation & Defaulting tab.
  2. Enter a formula to copy the value from the locked field into this custom field:
  • Use NetSuite formula syntax to reference the locked field.
  • Example Formula: NVL({lockedfieldid}, '')
  • Replace lockedfieldid with the actual internal ID of the locked field.
  • NVL ensures that a default value is set if the field is empty.

3.Save the custom field.

Step 4: Use the Custom Field in Templates

  1. Open the template where you need to use the value (e.g., email templates, PDF templates, etc.).
  2. Reference the custom field instead of the locked field:
  • Example: ${record.customfieldid}
  • Replace customfieldid with the internal ID of the newly created custom field.

3.Save and test the template to ensure the custom field displays the expected value.

Example

You want to include the value of a locked field custbody_lockedfield in a sales order template.

Steps:

  1. Create a custom field custbody_customtemplatefield.
  2. Add a formula in the Validation & Defaulting tab:
{custbody_lockedfield}
  1. Save the custom field.
  2. Use the custom field in the template:
${record.custbody_customtemplatefield}
  1. Test the template to confirm the correct value is displayed.

Leave a comment

Your email address will not be published. Required fields are marked *