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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

SSRS report error - Parameter doesn't get passed

(0) ShareShare
ReportReport
Posted on by 642

Hi Experts,

I have created a custom SSRS report which needs to be printed from a form i.e.. the argument should pass to the report from the form. The report does not work and gives me the error while trying to generate, A value must be provided for the parameter Load Id. I will provide my code here, can anyone help me to find out if i missed something or what is the issue with the code please. Load id is my parameter for the report. 

Contract class:- 

[DataContractAttribute]

public class SalesLoadPackingSlipContract

{

    WHSLoadId   LoadId;

    

    [

        DataMemberAttribute('Load Id'),

        SysOperationLabelAttribute(literalStr(/Load Id/)),

        SysOperationControlVisibilityAttribute(true)

    ]

    

    public WHSLoadId parmLoadId(WHSLoadId _LoadId = LoadId)

    {

        LoadId = _LoadId;

        return  LoadId;

    }

}

 

Controller class:- 

class SalesLoadPackingSlipController extends SrsReportRunController
{       
    public static void main(Args _args)
    {
        SalesLoadPackingSlipController    controller = new SalesLoadPackingSlipController();
        WHSLoadTable wHSLoadTable;
        wHSLoadTable = _args.record() as wHSLoadTable;
        controller.parmArgs(_args);
        controller.parmReportName(ssrsReportStr(SLoadPackingSlip, Common));
        controller.parmShowDialog(false);
        controller.startOperation();
    }
}
 
DP Class:-
 
[SRSReportParameterAttribute(classStr(SalesLoadPackingSlipContract))]
class SalesLoadPackingSlipDP extends SRSReportDataProviderBase  //SrsReportDataProviderPreProcess //
{
    //contract Class
    SalesLoadPackingSlipContract  salesLoadPackingSlipContract;
    //Temporary Tables to get report Data
    LoadPackingSlipHeaderTmp   loadPackingSlipHeaderTmp;
    LoadPackingSlipLineTmp     loadPackingSlipLineTmp;
 
    //Data Tables
    CompanyInfo            companyInfo;
    CustPackingSlipJour    custPackingSlipJour;
    CustPackingSlipTrans   custPackingSlipTrans;
    WHSLoadTableCustPackingSlipJour wHSLoadTableCustPackingSlipJour;
    
    //Report Parameter value
    WHSLoadId       LoadId;
    [SRSReportDataSetAttribute(tablestr(LoadPackingSlipHeaderTmp))]
    public LoadPackingSlipHeaderTmp getLoadPackingSlipHeaderTmp()
    {
        select loadPackingSlipHeaderTmp;
        return loadPackingSlipHeaderTmp;
    }
    [SRSReportDataSetAttribute(tablestr(LoadPackingSlipLineTmp))]
    public LoadPackingSlipLineTmp getLoadPackingSlipLineTmp()
    {
        select loadPackingSlipLineTmp;
        return loadPackingSlipLineTmp;
    }
    private void getReportParameters()
    {
        salesLoadPackingSlipContract contract = this.parmDataContract();
        if (contract)
        {
            LoadId   = contract.parmLoadId();
        }
    }
    [SysEntryPointAttribute(false)]
    public void processReport()
    {
        //to fetch report parameters
        this.getReportParameters();
        companyInfo = CompanyInfo::find();
        CustTable       CustTable;
        WHSLoadLine     whsLoadLine;
        salesLoadPackingSlipContract = this.parmDataContract() as salesLoadPackingSlipContract;
        if(LoadId)
        {
            loadPackingSlipHeaderTmp.LoadId = LoadId;  // Added just one line for testing purpose
            loadPackingSlipHeaderTmp.insert();
        }
    }
}
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,811 Super User 2026 Season 1 on at
    Hi @Alex,
     
    this problem has occurred when the parameter in report does not accept nullable or empty value.
    so you must go to the report and select the parameter and set :
    Allow blank true and nullable true.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Martin Dráb Profile Picture
    240,312 Most Valuable Professional on at
    I see you set wHSLoadTable in main(), but you never pass it to the contract class. You'd need to do something like this:
    SalesLoadPackingSlipContract contract = this.parmReportContract().parmRdpContract() as SalesLoadPackingSlipContract;
    contract.parmLoadId(wHSLoadTable.LoadId);

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288 Super User 2026 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 276 Most Valuable Professional

#3
Anton Venter Profile Picture

Anton Venter 225 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans