Skip to main content

Notifications

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 604

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();
        }
    }
}
  • Martin Dráb Profile Picture
    234,180 Most Valuable Professional on at
    SSRS report error - Parameter doesn't get passed
    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);
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    23,910 Super User 2025 Season 1 on at
    SSRS report error - Parameter doesn't get passed
    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

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Martin Dráb Profile Picture

Martin Dráb 601 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 416

#3
Adis Profile Picture

Adis 384 Super User 2025 Season 1

Product updates

Dynamics 365 release plans