Search code examples
kofax

Don't show UI when removing export script from document class


When adding an export script to a document class the RunUI method gets fired and shows the setup form. When removing the script this happens too. I would like to prevent it because there is no need for it.

In my ActionEvent method I could create a switch for the KfxActionValue.

I don't want to show the UI when removing the script but I want to show it when adding the script or when I want to edit it.

The documentation is not very helpful as you can see here

Kofax

I took the Sharepoint example and the KCEC Text example and created this

    public KfxReturnValue ActionEvent(KfxActionValue actionID, string data1, string data2)
    {
        try
        {
            bool showUI = false;

            switch (actionID)
            {
                case KfxActionValue.KFX_REL_INDEXFIELD_INSERT:
                case KfxActionValue.KFX_REL_INDEXFIELD_DELETE:
                case KfxActionValue.KFX_REL_BATCHFIELD_INSERT:
                case KfxActionValue.KFX_REL_BATCHFIELD_DELETE:
                        showUI = true;
                        break;

                //case KfxActionValue.KFX_REL_UNDEFINED_ACTION:
                //case KfxActionValue.KFX_REL_DOCCLASS_RENAME:
                //case KfxActionValue.KFX_REL_BATCHCLASS_RENAME:
                //case KfxActionValue.KFX_REL_INDEXFIELD_RENAME:
                //case KfxActionValue.KFX_REL_BATCHFIELD_RENAME:
                //case KfxActionValue.KFX_REL_RELEASESETUP_DELETE:
                //case KfxActionValue.KFX_REL_IMPORT:
                //case KfxActionValue.KFX_REL_UPGRADE:
                //case KfxActionValue.KFX_REL_PUBLISH_CHECK:
                //case KfxActionValue.KFX_REL_START:
                //case KfxActionValue.KFX_REL_END:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_INSERT:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_RENAME:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_DELETE:
                //case KfxActionValue.KFX_REL_TABLE_DELETE:
                //case KfxActionValue.KFX_REL_TABLE_INSERT:
                //case KfxActionValue.KFX_REL_TABLE_RENAME:
                //default:
                //    break;
            }

            if (showUI)
            {
                return RunUI();
            }

            return KfxReturnValue.KFX_REL_SUCCESS;
        }
        catch (Exception e)
        {
            setupData.LogError(e.ToString());
            throw e;
        }
    }

but I'm not sure if this is correct. It works. But where can I get more information about it?


Solution

  • Your approach is correct. There isn't much more information about those action events in the official documentation, yet the basic concept is explained in the Developer's Guide (you will need a valid Kofax account to download the documentation).

    Here's my cheat sheet:

    • KFX_REL_UNDEFINED_ACTION - unknown
    • KFX_REL_DOCCLASS_RENAME - renamed the associated document class(es)
    • KFX_REL_BATCHCLASS_RENAME - renamed the batch class
    • KFX_REL_INDEXFIELD_DELETE - removed an existing index
    • KFX_REL_INDEXFIELD_INSERT - added a new index field
    • KFX_REL_INDEXFIELD_RENAME - renamed an existing field
    • KFX_REL_BATCHFIELD_DELETE - removed an existing batch field
    • KFX_REL_BATCHFIELD_INSERT - added a new batch field
    • KFX_REL_BATCHFIELD_RENAME - renamed an existing field
    • KFX_REL_RELEASESETUP_DELETE - removed the Export Connector from the document class
    • KFX_REL_IMPORT - called when the batch class is imported (not tested!)
    • KFX_REL_UPGRADE - called when the user hits the "Upgrade" button (must be supported by the Export Connector)
    • KFX_REL_PUBLISH_CHECK - called when the batch class is validated or published
    • KFX_REL_START - called whenever the release (setup) script is called, for example when adding an index field
    • KFX_REL_END - called when the setup script is closed
    • KFX_REL_FOLDERCLASS_INSERT - added a new folder class
    • KFX_REL_FOLDERCLASS_RENAME - renamed an existing folder class
    • KFX_REL_FOLDERCLASS_DELETE - removed an existing folder class
    • KFX_REL_TABLE_DELETE - deleted an existing table
    • KFX_REL_TABLE_INSERT - inserted a new table
    • KFX_REL_TABLE_RENAME - renamed an existing table

    Note that some events will be fired in succession. For example, renaming the batch will fire KFX_REL_START, then KFX_REL_BATCHCLASS_RENAME, and finally KFX_REL_END.