DMFEntity issue : Entity query version '*' is not matching with AOT version '*'

Sometimes we get an error on DMF Entity that query version is not matching with AOT version, To fix this issue we can update our Entity QueryVersion With respect to AOT QueryVersion .

Job to update Query Version:

static void GTE_DMFQueryVersionUpdateJob(Args _args)
{
    DMFentity entity;
    int a = 0;

    #AOT

    #define.Version('Version')

     TreeNode        treeNode;
    ttsBegin;

    while select forUpdate entity
    {

        if (entity.EntityType == DMFEntityTypes::Entity)

           {

               treeNode = treeNode::findNode(#QueriesPath + #AOTDelimiter + entity .TargetEntity);

               if (treeNode)

               {

                   entity .QueryVersion = treeNode.AOTgetProperty(#Version);

               }

                entity.doupdate();
               a++;

           }
    }
    ttsCommit;
    info(int2str(a));  //NO# of Updated Records
}

Comments

Popular posts from this blog

D365: SSRS Report Development/ Customization

D365: X++ code to add custom lookup on worker to show specific workers team workers only

Dynamics ax 2012: Sample code for fetching records in tmp table using query and Insert record set