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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Initialize Parameters in the SSRS Contract

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

I have read the implementations for SysOperationInitializable (to initialize parameters), SysOperationValidatable (to validate parameters).

I want to set the FromDate and ToDate to certain values based on Today(). 

The SysOperationValidatable  works.

I am not able to get SysOperationInitializable to work. The code does not seem to execute the Initialize ( ) Method. What am I missing ?

The code is below. I know this has been discussed long time back, but I cannot get the code in Initialize ( ) to execute.

ClassDeclaration

[DataContractAttribute]
class BM_072_Contract implements SysOperationInitializable, SysOperationValidatable
{

BaseDate FromDate, ToDate;

}

Initialize ( )

public void initialize()
{
FromDate = systemDateGet() - 40;
ToDate = systemDateGet() - 10;
}

[DataMemberAttribute("From Date"),
SysOperationLabelAttribute("From Date"),
SysOperationDisplayOrderAttribute('1')]
public BaseDate ParmFromDate(FromDate _FromDate = FromDate)
{
FromDate = _FromDate;

return FromDate;
}

[DataMemberAttribute("To Date"),
SysOperationLabelAttribute("To Date"),
SysOperationDisplayOrderAttribute('2')]
public BaseDate ParmToDate(ToDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}

public boolean validate()
{
//Validate the input parameters.
boolean isValid = true;

if (!FromDate)
{
isValid = checkFailed("From Date should be entered");
}
if (!ToDate)
{
isValid = checkFailed("To Date should be entered");
}
if (isValid && (FromDate > ToDate))
{
isValid = checkFailed(strfmt("From Date should be less than or equal to To Date",
date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
}
return isValid;

}

I have the same question (0)
  • Blue Wang Profile Picture
    on at

    HI Vikash,

    Add attribute SysOperationAlwaysInitializeAttribute.

    Reference: https://www.schweda.net/blog_ax.php?bid=445&wdl=en

    [DataContractAttribute,SysOperationAlwaysInitializeAttribute]
    class BM_072_Contract implements SysOperationInitializable, SysOperationValidatable
    {
    
    BaseDate FromDate, ToDate;
    
    }

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans