When a script depends on a custom field, the field design should be planned before development begins. A field that is created quickly for scripting may work at first, but later cause issues if the type, ID, permissions, or behavior are not aligned with the script logic.
Planning the field early helps make the script easier to build, test, and maintain.
Scenario
A team needs a SuiteScript customization that uses a custom field as part of its logic.
Examples may include:
- a checkbox that triggers processing
- a status field used by a script condition
- a date field used for scheduled follow-up
- a reference field used to find a related record
- a text field used to store an external ID or response value
If the field is not designed correctly, the script may fail, update the wrong value, or become harder to maintain.
Solution
Plan the custom field before scripting begins.
The admin and developer should confirm the field purpose, type, ID, placement, permissions, and expected values before the script is written.
This helps avoid rework after development starts.
What to Plan Before Scripting
Field Purpose
Define exactly what the field is used for.
Examples:
- controls whether a script should run
- stores a script result
- identifies a related record
- tracks processing status
- stores an integration reference
A field should have one clear purpose so the script logic stays simple.
Field Type
Choose a field type that matches the script requirement.
Examples:
- Checkbox – useful for true or false logic
- List/Record – useful for controlled status or related records
- Date – useful for follow-up or scheduled processing
- Free-Form Text – useful for external references
- Integer Number – useful for counts or sequence values
The field type affects how the script reads, compares, and updates the value.
Field ID
Use a clear script ID.
Example:
custrecord_processing_status
Avoid unclear IDs such as:
custrecord_field1custrecord_test_statuscustrecord_temp_value
A clear ID makes the script easier to read and support.
Field Values
If the field uses a list, define the approved values before scripting.
Example status values:
- Pending
- Processing
- Complete
- Error
This helps the developer write clear conditions and avoid inconsistent values.
Field Placement and Visibility
Confirm where the field should appear.
Some script-related fields may need to be visible to users. Others may be better hidden or read-only.
Examples:
- visible status field for user tracking
- hidden processing flag for script logic
- read-only external reference field
The display choice should match the business purpose.
Permissions
Confirm which roles can view or edit the field.
If a user or script needs to update the field, permissions should support that process.
Be careful with fields that affect processing logic. Users should not edit script-control fields unless the business process requires it.
References
- SA: Creating a Custom Field (ID: 10078)
- SA: SuiteCloud (ID: 1014757)
- SA: SuiteScript (ID: 31709)
Notes
- Do not create script fields without a clear purpose.
- Choose the correct field type before writing logic.
- Use clear field IDs that developers can understand.
- Avoid letting users edit fields that control automation unless needed.
- Use controlled list values when scripts depend on specific statuses.
- Test field behavior with the script in sandbox before production.
- Document how the field is used by the script.
Summary
A custom field used by script logic should be planned carefully before scripting begins. The field purpose, type, ID, values, visibility, and permissions can all affect how the script behaves.
Good field planning helps reduce rework, improve script reliability, and make the customization easier to maintain.
Share your insights and experiences in the NetSuite Admin Corner.