Custom Action for Field in Document Definition editor

  • 99 Views
  • Last Post 05 September 2018
  • Topic Is Solved
Aliaksandr_Sidarau posted this 24 August 2018

Hello!

I am trying to run a C# script which takes a substring from one field (text matched to regular expression) and writes its content to another field.

The problem is that when I run test in Script Editor window an error message pops up which says:

System.Runtime.InteropServices.COMException (0x80004005): Unable to modify a read-only field 'ContractorOKPO'. at ABBYY.FlexiCapture.IField.IField.set_Text(String _result).

 

Does it mean that there is no way manipulating Fields values with scripts at a Document Definition level?

There is confusion about stated error as documentation says that Text property of IField type is nor READ-ONLY

 

This is the script I am trying to run:

 

using System;
using System.Text.RegularExpressions;

IField dataField, OKPOField;

OKPOField = Context.Field("ContractorOKPO");
dataField = Context.Field("ContractorData");

string extractedData;
string OKPO;

extractedData = dataField.Text;
OKPOField.Text = extractedData;

Would be happy to hear suggestions from anyone around.

Order By: Standard | Newest | Votes
Collins Sarmento posted this 24 August 2018

Hello

Make sure in the window where you add the fields to be used you have unchecked the readonly checkbox for the proper field.

Let me know if that does not work.

 

Thanks,

Collins

  • Liked by
  • Aliaksandr_Sidarau
Aliaksandr_Sidarau posted this 31 August 2018

Thank you, didn't notice it at first. 

davidjren posted this 05 September 2018

thank you 

Close