Skip to main content

Notifications

Announcements

No record found.

Handling business logic on triggering events of dialog methods of SSRS report in D365FO

Hi,

Please refer to my earlier post to view the report SSRSPrecisionDesign related classes, tables and menu Item.

https://community.dynamics.com/365/financeandoperations/b/daxology/posts/creating-a-simple-report-in-d365fo

Custom Tables: SampleTable and SampleTrans

In this post, we will how can we substitute custom method in place of dialog field event methods like modified, lookup and so on. For demo purpose, let us try to  default the dialog field end date value with the dialog field start date value whenever start date value is modified. 

Note: Please generate the labels accordingly, for demo purpose static text is left as-is.

Step 1: Created a UI builder class SSRSReportUIBuilder(namely) for the contract class SSRSReportContract

class SSRSReportUIBuillder extends SrsReportDataContractUIBuilder.
Step 2: Referenced it on contract class. 
[
DataContractAttribute,
SysOperationContractProcessingAttribute(classStr(SSRSReportUIBuillder), SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly),
SysOperationGroupAttribute('Criteria',"Criteria",'1')
]
class SSRSReportContract implements SysOperationValidatable, SysOperationInitializable

Step 3: Implemented the build method to get the dialog field values of StartDate and EndDate.

 /// <summary>
/// The <c>SSRSReportUIBuillder</c> class builds the UI for the <c>SSRSPrecisionDesignReport</c> SSRS report parameters
/// </summary>
public void build()
{
SSRSReportContract reportContract;

super();

reportContract = this.dataContractObject() as SSRSReportContract;

startDateField = this.bindInfo().getDialogField(reportContract, methodStr(SSRSReportContract, parmStartDate));
endDateField = this.bindInfo().getDialogField(reportContract, methodStr(SSRSReportContract, parmEndDate));
}

Step 4: Created new method by name OnStartDateModified which defaults the EndDate value with StartDate on modifying StartDate value.

/// <summary>
/// Overridden method of StartDate dialog field's modified method.
/// </summary>
/// <returns>
/// boolean variable value as true if its modified
/// </returns>
public boolean onStartDateModified(FormDateControl _dateControl)
{
endDateField.value(startDateField.value());

return true;
}

Step 5: Implemented the method postBuild to substitute the method onStartDateModified in place of modified method of dialog field StartDate.

/// <summary>
/// Post build method
/// </summary>
public void postBuild()
{
super();
startDateField.registerOverrideMethod(methodStr(FormDateControl, modified), methodStr(SSRSReportUIBuillder, onStartDateModified), this);
}
Step 6: Built the solution and end date is getting defaulted by the value of start date, on modifying the start date value.
Regards,

Chaitanya Golla

Comments

*This post is locked for comments