FieldValue Object Members in SuiteScript 2.1 Reference

FieldValue object members in SuiteScript 2.1 provide confidence levels and text values for extracted fields, crucial for accurate data processing.

·2 min read·View Oracle Docs

The FieldValue object in SuiteScript 2.1 is essential for handling values extracted from documents, particularly when utilizing the N/documentCapture module. It is composed of two primary members: FieldValue.confidence and FieldValue.text, which are integral for ensuring accurate data extraction in your scripts.

What Are the Members of the FieldValue Object?

The FieldValue object includes the following members:

Member NameReturn TypeSupported Script TypesDescription
FieldValue.confidencenumberServer scriptsConfidence level of the field value
FieldValue.textstringServer scriptsText of the field value

How Does the Confidence Property Work?

The FieldValue.confidence property is a numeric value ranging from 0 to 1, representing how sure the system is about the accuracy of the field value specified in FieldValue.text. A confidence level of 0.95 indicates that the service is 95% confident in the extracted field value, allowing developers to set thresholds for data acceptance to mitigate errors. For instance, you could decide to only accept values with a confidence above 0.90.

Example of Using FieldValue in a Script

Here’s a practical example of how you might utilize the FieldValue members in your SuiteScript:

suitescript
1const extractedData = documentCapture.documentToStructure({
2 file: file.load("SuiteScripts/sample_tax_form.pdf"),
3 documentType: documentCapture.DocumentType.TAX_FORM,
4 features: [documentCapture.Feature.FIELD_EXTRACTION]
5});
6
7const fieldValueToProcess = extractedData.pages[0].fields[0].value;
8
9if (fieldValueToProcess.confidence > 0.9) {
10 // Accept the field value
11} else {
12 // Reject the field value
13}

Error Codes

One important aspect to consider is that both properties are read-only. Attempting to set their values will trigger a READ_ONLY error.

Who This Affects

This reference impacts:

  • Developers: Specifically those working on server scripts, enabling better data extraction handling.
  • System Integrators: Who need to ensure data accuracy from document captures in their integrated systems.

Key Takeaways

  • The FieldValue object members are essential for processing extracted data in SuiteScript 2.1.
  • FieldValue.confidence allows setting accuracy thresholds for data handling.
  • Error handling is crucial as both properties are read-only.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Is the FieldValue object applicable to both client and server scripts?
The FieldValue object is supported only in server scripts as per the provided information.
What happens if you attempt to modify the confidence level of a FieldValue object?
Attempting to set the values of FieldValue.confidence or FieldValue.text will trigger a READ_ONLY error, as both properties are read-only.
How can developers use the confidence property to enhance data accuracy in SuiteScript?
Developers can utilize the confidence property to set thresholds for data acceptance, only processing values above a certain confidence level, such as 0.9, to ensure better accuracy in data extraction.
Does the FieldValue object require any specific feature or module within SuiteScript?
Yes, the FieldValue object is utilized when working with the N/documentCapture module, specifically for handling document-captured values.
Source: FieldValue Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →