Skip to main content
Community site session details

Community site session details

Session Id :

AIF: The class method for the specified action %1 could not be found

Klaas Deforche Profile Picture Klaas Deforche 2,433

When you get this error:

The class method for the specified action %1 could not be found

It probably means you have regenerated you classes using the AIF document wizard, or that you have imported the AIF classes without id’s.

You can use this job to fix the class id’s in the AIFAction table:

static void KlForFixAIFActions(Args _args)
{
    AIFAction   aIFAction;
    ClassId     classId;

    // inner method:
    // spit string at delimeter, keep left substring
    str lSplit( str _s, str _delimeter )
    {
        str s = "";
        int pos;
        int len = strlen( _s );

        pos = strfind( _s, _delimeter, 0, len );
        s = strdel( _s,pos,len-pos+1);

        return s;
    }
    ;

    // fix all actions
    while select aIFAction
    {
        // get 'real' classid
        classId = classname2id(lSplit(aIFAction.ActionId, '.'));

        // check if classid and classname match
        if(aIFAction.ClassId != classId)
        {
            if(classId == 0)
            {
                // class does not exist
                warning(strfmt("Class %1 does not exist", lSplit(aIFAction.ActionId, '.')));
            }
            else
            {
                // doesn't match
                // update classid
                ttsbegin;
                aIFAction.selectForUpdate(true);
                aIFAction.ClassId = classId;
                aIFAction.update();

                info(strfmt('Action %1 updated', aIFAction.ActionId));
                ttscommit;
            }
        }
    }

    info('done');
}

Comments

*This post is locked for comments