Property Value Length and Limits

Limits are applied to property values that are submitted by the plug-in through the Plugin API for update. If a value length exceeds the limit, Oracle Field Service returns an error message as part of the message with the error method.

Fields (property type is 'field')

Maximum un-formatted data to store is 239 bytes. JavaScript uses UTF-16 for strings, so one Unicode character may take up 2 to 4 bytes. But, the String.length property uses UTF-16 code points for counting, which is 2 bytes. This means, the length of the string containing one 4-byte UTF-16 char is 2. So, only ceil(239/2) = 119 code points can be stored without truncating.

Signatures (property type is 'file' and GUI option is 'Signature')

We assume that the value contains only MIME-type and correct base64 string. So, each character takes up 2 bytes as JavaScript uses UTF-16. To avoid overflow of LocalStorage, each signature is limited with 200 KB (1024*200/2 = 102400 characters).

File Properties (property type is 'file' and GUI is not 'Signature')

Maximum allowed length for a file property value depends on the "File size limit" attribute configured for the property, but it can't exceed 20 MB (20971520 bytes) in any case.

Properties (any other property type)

Maximum amount of data to store is 65 535 bytes (2^16 - 1). Oracle Field Service internally uses the UTF-8 encoding, so the value is converted to UTF-8 representation before checking against the limit. One Unicode character (code point) may take up 1 to 4 bytes in UTF-8. But, JavaScript uses UTF-16 for strings, so one character takes up 2 to 4 bytes. The String.length property uses UTF-16 code units for counting, which is 2 bytes. So the length of the string that contains one 1 or 2-byte Unicode char is 1. The length of the string that contains one 3 or 4-byte Unicode char (code point) is 2. There's also a range of 2-byte Unicode code points (U+0800 - U+10000) that take up 2 bytes (1 code unit) in UTF-16 (e.g. ¿ - \u20AC), but require 3 bytes in UTF-8. So, only 65535/3 = 21845 code units are always under limit. If the length of the string is grater that 21845, it may or may not pass the validation depending on its contents. To know whether the property value is of valid length, it must be converted to UTF-8, for example:
function isPropertyLengthValid(value) {
 
    if (('' + value).length <= }}{{21845) {
        return true;
    }
 
    if (('' + value).length > }}{{65535) {
        return false;
    }
     
    var utf8Encoder = }}{{new TextEncoder();
    var utf8BytesArray = utf8Encoder.encode(value);
 
    utf8Encoder = }}{{null;
 
    if (utf8BytesArray.length <= }}{{65535) {
        return true;
    }
 
    return false;
}

File Properties

Plugin API supports updating of file properties. The plug-in sends the values of file properties with the regular properties in the entity collections or inventory actions as part of the close message. Due to performance limitations, it's not rational to send the file contents using JSON strings, so the Plugin API accepts raw JS objects as the value for PostMessage data. File properties can be updated only using JS objects as message data. The value of the file property in the PostMessage data must be an object that has two properties:
  • fileName: Name of the file, that will be shown on the Oracle Field Service user interface

  • fileContents: Blob object that contains the file contents. It can be constructed and filled with the data generated by JS code in runtime, or just obtained from the file input and sent to Oracle Field Service Core Application without any transformation, as the File object inherits the Blob.

Contents of the file property value is validated against these rules:
  • Length of the file must be less than or equal to the configured File size limit

  • MIME type of the file must be equal to one of the configured Allowed MIME types