Community

Custom Action for Field in Document Definition editor Answered

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.

Was this article helpful?

0 out of 0 found this helpful

Comments

4 comments

  • Avatar
    Collins Sarmento

    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

    1
  • Avatar
    Aliaksandr_Sidarau

    Thank you, didn't notice it at first. 

    0
  • Avatar
    davidjren

    thank you 

    0
  • Avatar
    Vamseedharan

    Hi Collins,

    I have unchecked the ReadOnly CheckBox in the Document Definition Edit Window but still I am facing the same issue as 

     

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

     

    Any luck

    1

Please sign in to leave a comment.