Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to pass contract class values to service class in batch job?

(0) ShareShare
ReportReport
Posted on by 162
Hi ,
I am trying to fetch the data from contract class in service class but the values which come are blank. Kindly help.
 
Contract class- 
 
[DataContractAttribute]class BasisContract{    str                 user,license;    SecurityLicenseRole licenseRole;public str parmUser(str _user = user)    {        user = _user;         return user;    }    public str parmLicense(str _license = license)    {        license = _license;         return license;    }    }
Controller class
class BasisController extends SysOperationServiceController {            protected void new ()     {         super();         this.parmClassName(classStr(BasisService));         this.parmMethodName(methodStr(BasisService,processOperation));      }          public static void main (Args _args)     {         BasisController controller;         BasisContract    contract;         container result;          controller = new BasisController();         controller.showBatchTab(false);         controller.parmShowDialog(false);         result = str2con(_args.parm());                controller.parmLoadFromSysLastValue(false);        contract = controller.getDataContractObject('_contract');        contract.parmUser(conPeek(result,1));                contract.parmLicense(conPeek(result,2));        controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);                                   controller.startOperation();          }}
Service Class
 
class BasisService extends SysOperationServiceBase{        [SysEntryPointAttribute(false)]    public void processOperation(BasisContract _contract)    {              container               conUser;               conUser     = str2con(_contract.parmUser());                  } }
 
  • Harshal Jain Profile Picture
    Harshal Jain 162 on at
    How to pass contract class values to service class in batch job?
    Thanks Martin. It resolved the error.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 231,329 Most Valuable Professional on at
    How to pass contract class values to service class in batch job?
    I see an obvious problem - you forgot to decorate parmUser() and parmLicense() with DataMember attribute.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,329 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans