HubSpot Connector 25.2
HubSpot Connector Help

# Add a Field to a Document

The following script demonstrates how to add a field named “MyField” to a document, with a value of “MyValue”.

    function handler(config, document, params)
    	document:addField("MyField", "MyValue");
    	return true;
    end

The following script demonstrates how to add the field `AUTN_NEEDS_MEDIA_SERVER_ANALYSIS` to all JPEG, TIFF and BMP documents. This field indicates to CFS that the file should be sent to a Media Server for analysis (you must also define the `MediaServerAnalysis` task in the CFS configuration file).

The script finds the file type using the `DREREFERENCE` document field, so this field must contain the file extension for the script to work correctly.

    function handler(config, document, params)
    	local extensions_for_ocr = { jpg = 1 , tif = 1, bmp = 1 };
    	local filename = document:getFieldValue("DREREFERENCE");
    	local extension, extension_found = filename:gsub("^.*%.(%w+)$", "%1", 1);

    	if extension_found > 0 then
    		if extensions_for_ocr[extension:lower()] ~= nil then
    		   document:addField("AUTN_NEEDS_MEDIA_SERVER_ANALYSIS", "");
    		end
    	end

    	return true;
    end

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery HubSpot Connector 25.2

Topic Title: Add a Field to a Document