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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

DataMemberAttribute in Contract class

(0) ShareShare
ReportReport
Posted on by

Hi all,

Usually when we create a Data Contract class when creating a SSRS report, we put something like this for the parameter :

[ DataMemberAttribute("Firstname"),

SysOperationLabelAttribute(literalStr("@SYS32695")),

SysOperationDisplayOrderAttribute('2')

]

public Name parmFirstname(Name _firstName = firstName)

{

firstName = _firstName;

return firstName;

}

My question, can we put a default value in the box ? so when I run this report, and UI some of the field already has default value.

Thanks

I have the same question (0)
  • Blue Wang Profile Picture
    on at
    RE: DataMemberAttribute in Contract class

    Hi Wwwong,

    First, I agree to use SysOperationInitializable.

    In addition, I would like to ask if you have a controller class?

    You can override method prePromptModifyContract in controller class, then add code to set your default value.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: DataMemberAttribute in Contract class

    You can either implement SysOperationInitializable  or assign a value during variable declaration, here is an example https://erconsult.eu/blog/extending-sysoperation-contracts-with-datamemberattribute/

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: DataMemberAttribute in Contract class

    Hi WWwong,

    There are a couple of interfaces that can bring additional "features" to contract classes. One of them is SysOperationInitializable, which allows you to initialize variables with default values. You just need to indicate that your contract implements a certain interface with "implements" keyword and implement interface methods in your contract.

    www.anegis.com/.../initialisation-and-validation-of-data-contract-in-ax-2012

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,072

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 831 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 829 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans