web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

sysoperation framewrok No metadata class defined for data contract object

(0) ShareShare
ReportReport
Posted on by 942

Hello,

I'm trying to learn sysoperation framework class. I've written 3 classes:

1) Contract:

[DataContractAttribute]

class SimpleBatchJobContract

{

    str         text;

}

[  

    DataMemberAttribute('Text'),

    SysOperationLabelAttribute("@ICL363"),

    SysOperationControlVisibilityAttribute(true)]

public str parmText (str _text = text)

{

    text = _text;

    return text;

}

2) Service:

class SimpleBatchJobService  extends SysOperationServiceBase

{

}

 [SysEntryPointAttribute]

public void run(SimpleBatchJobContract _batchJobContract)

{

    ;

    try

    {

        info(strFmt('%1',_batchJobContract.parmText()));    }

    catch

    {

        info(funcName());

    }

}

 3) Controller:

// Объявление класса-наследника SysOperationServiceController

class SimpleBatchJobController extends SysOperationServiceController

{

}

 

// Данный метод содержит описание задачи

public ClassDescription caption()

{

    return("Пример простого пакетного задания");

}

protected void initService()

{

    this.parmClassName(classStr(SimpleBatchJobService));

    // Указание метода Service класса, который будет запущен

    this.parmMethodName(methodStr(SimpleBatchJobService, run));

    // Указание режима запуска класса Service

    this.parmExecutionMode(SysOperationExecutionMode::Synchronous);

}

public static SimpleBatchJobController construct()

{

    return new SimpleBatchJobController();

}

public static void main(Args _args)

{

    SimpleBatchJobController controller;

    ;

    controller = SimpleBatchJobController::construct();

    controller.initService();

    controller.startOperation();

}

when i try to launch controller class I get the error:

No metadata class defined for data contract object

Can you help me to understand what's wrong?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi!

    It means that you are trying to use a type as a data contract that is not a valid data contract type.

    Take a look at this link:

    community.dynamics.com/.../no-metadata-class-defined-for-data-contract-object

    www.artofcreation.be/.../

  • dark_knight Profile Picture
    942 on at

    i've read through both articles. it's written everywhere that I can use a class marked with attribute [DataContractAttribute] as a valid data contract. Therefor I suppose it's valid contract type. Increment compiling did the trick for me. Now it works. Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans