Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Object 'RecordSortedList' could not be created

Posted on by 2,016

i did create new ssrs report and i add code to my costume button 

void clicked()
{
    SrsReportRunController            controller;
    DemoContract contract = new DemoContract();

    super();

    controller = new SrsReportRunController();
    controller.parmReportName(ssrsReportStr(CaseReports, Request));
    controller.parmShowDialog(false);

    contract.parmCaseId(CaseDetailBase_1_CaseId.valueStr());
    controller.parmReportContract().parmRdpContract(contract);

    controller.startOperation();
}

when i press on my button to print my ssrs i got those message

0385.1111111.JPG

*This post is locked for comments

  • Pradeep_Prakash Profile Picture
    Pradeep_Prakash 715 on at
    RE: Object 'RecordSortedList' could not be created

    Just adding the value to parm method will not help in filtering the query. You need to have the controller class and filter the range in pre-prompt modify contract .

    You can't achieve this in clicked method.

    Regards,

    Pradeep

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: Object 'RecordSortedList' could not be created

    but i delete this class SSRSDemoController because i replace it with button clicked();

  • Suggested answer
    Pradeep_Prakash Profile Picture
    Pradeep_Prakash 715 on at
    RE: Object 'RecordSortedList' could not be created

    Hi,

    In pre-prompt modify contract instead of caseID . You are passing args recid (SysQuery::value(this.parmArgs().record().RecId));) can you correct and see that?

    Regards,

    Pradeep

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: Object 'RecordSortedList' could not be created

    thanks Pradeep Prakash

    now it's work fine without error (after restart aos) and i only use class contract and click method

    //this Contract Class
    [DataContractAttribute]
    public class DemoContract
    {
        CaseId caseIdxx;
    }
    
    [DataMemberAttribute("CaseId")]
    public CaseId parmCaseId(CaseId _CaseId = caseIdxx)
    {
        caseIdxx = _CaseId;
        return caseIdxx;
    }
    
    
    
    //this code below on button 
    void clicked()
    {
        SrsReportRunController            controller;
        DemoContract contract = new DemoContract();
    
        super();
    
        controller = new SrsReportRunController();
        controller.parmReportName(ssrsReportStr(CaseReports, Request));
    
        contract.parmCaseId(CaseDetailBase_1_CaseId.valueStr());
        controller.parmReportContract().parmRdpContract(contract);
    
    
        controller.parmShowDialog(false);
        controller.startOperation();
    }

    but i have small problem

    when i press print button on any row i selected from (CaseListPage) form

    it keep show me same report (i think it's parameter issue not pass to report)

    how can i solve that

  • Pradeep_Prakash Profile Picture
    Pradeep_Prakash 715 on at
    RE: Object 'RecordSortedList' could not be created

    Hi,

    Can you give us the call stack for the error? to get more information.

    Regards,

    Pradeep

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: Object 'RecordSortedList' could not be created

    thanks Pradeep Prakash for replay

    i did generate full CIL

    and stil same problem

  • Pradeep_Prakash Profile Picture
    Pradeep_Prakash 715 on at
    RE: Object 'RecordSortedList' could not be created

    Hi,

    Can you clear the usage data and try running a full CIL and check again?

    Regards,

    Pradeep

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: Object 'RecordSortedList' could not be created

    thanks for repaly i did almost as you said but stil same problem and stil ask me to create contract here my codes of class controller can you please tell me what should i do on my code

    [
         SRSReportQueryAttribute('CaseId'),
         SRSReportParameterAttribute(classstr(DemoContract))
     ]
    class SSRSDemoController extends SrsReportRunController
    {
    
    }
    
    
     protected void prePromptModifyContract()
    {
      SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(CaseDetailBase),fieldNum(CaseDetailBase, CaseId),SysQuery::value(this.parmArgs().record().RecId));
    
    }
    
    protected void preRunModifyContract()
    {
         //define object for report contract
        DemoContract contract;
    
        //get the reference of the current contract object
        contract = this.parmReportContract().parmRdpContract() as DemoContract;
    
        //modify the parameter value of the contract
        contract.parmCaseId(this.parmArgs().parm());
    }
    
    
    public static client void main(Args args)
    {
    //define the new object for controller class
    
    SSRSDemoController ssrsDemoController;
    
    ssrsDemoController = new SSRSDemoController();
    
    //pass the caller args to the controller
    
    ssrsDemoController.parmArgs(args);
    
    //set the report name and report design to run
    
    ssrsDemoController.parmReportName(ssrsReportStr(CaseReports,Request));
    
    //execute the report
        ssrsDemoController.parmShowDialog(false);
    ssrsDemoController.startOperation();
    }
    


  • Suggested answer
    AhmedMgamal Profile Picture
    AhmedMgamal 75 on at
    RE: Object 'RecordSortedList' could not be created

    The menu item you use in the form you have to set the data source property beside copy caller Query and need record.

    after that you can add the range in the controller throw preRunModifyContract method , you don't have to use contract class here just add a range to the Query , you can run the report to be sure that the param is populated on the report range form.

    then you can use "Controller.parmShowDialog(false)" to hide the parameter form and execute the report directly.

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: Object 'RecordSortedList' could not be created

    thanks mr.AhmedMgamal for replay

    i'm trying prevent show this parameters Dialog

    explin.JPG

    and i want when i press on print button must automatically print selected row directly without show me parameters Dialog form

    explin.JPG

    for example like when you print from invoice journal you don't need to see parameters Dialog

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans