How to group parameters in D365fo using x++?

How to group Parameters in X++

Scenario:

When dealing with multiple parameters in SysOperation or a report, we can group them to ensure better alignment and organization. Grouping parameters also allows them to be displayed with appropriate labels.

High level resolution steps

We can follow the below steps to Default parameters in SSRS report.

  • Navigate to the contract class.
  • Add the below code.

Detailed resolution steps

Step 1: Create a contract class and add the below code

First, we need to add the Group attribute above class decleration:

SysOperationGroupAttribute(‘Group Name’, ‘Group Label’, ‘Display order’).


[ 
  DataContractAttribute, 
  SysOperationGroupAttribute('Days', 'Days', '1'), 
  SysOperationGroupAttribute('Name', 'Name', '2') 
] 
class SCCParameters 
{
    

Now create the parameters and assign the group using SysOperationGroupMemberAttribute

SysOperationGroupMemberAttribute(‘Group Name’)


[  
    DataMember,  
    SysOperationLabel(literalStr('Number of days')),  
    SysOperationHelpText(literalStr('Enter the number of days')),  
    SysOperationGroupMemberAttribute('Days'),  
    SysOperationDisplayOrder('2')  
]  
public Integer parmNumOfDays(Integer _numOfDays = numOfDays)  
{  
    numOfDays = _numOfDays;  
    return numOfDays;  
}

    

Reference code Snapshot

OUTPUT

Open the parameter screen.

Now you can see the grouped parameters with labels