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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Parameter executionInfo cannot be null or empty.

(0) ShareShare
ReportReport
Posted on by 110

SysOutgoingEmailTable outgoingEmailTable;
PurchTable purchTable;
UserInfo userInfo;

FormRun form = sender.formRun();
FormDataSource purchTable_ds = form.dataSource(formDataSourceStr(PurchTable ,PurchTable))as FormDataSource;
purchTable = purchTable_ds.cursor();

if(purchTable.DocumentState == VersioningDocumentState::Confirmed)
{
str Body;
str Subject;
SRSPrintDestinationSettings printSettings;
SRSPrintDestinationSettings SRSPrintDestinationSettings;
SrsPrintMgmtExecutionInfo reportExecutionInfo;

PurchReqLine purchReqLine;
printJobHeader printJobHeader;

PurchPurchaseOrderContract                  contract = new PurchPurchaseOrderContract();

PurchPurchaseOrderController             controller = new PurchPurchaseOrderController();

controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));

reportExecutionInfo = controller.parmReportContract().parmReportExecutionInfo() as SrsPrintMgmtExecutionInfo;
if (!reportExecutionInfo)
{
reportExecutionInfo = new SrsPrintMgmtExecutionInfo();
}

controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
controller.parmShowDialog(false);
contract.parmRecordId(purchTable.RecId);

controller.parmReportContract().parmRdpContract(reportExecutionInfo);

controller.parmDialogCaption("Purchase order");

SRSPrintDestinationSettings = new SRSPrintDestinationSettings();
SRSPrintDestinationSettings.overridePrintContractSettings(true);
SRSPrintDestinationSettings.printMediumType(SRSPrintMediumType::Email);
SRSPrintDestinationSettings.emailAttachmentFileFormat(SRSReportFileFormat::PDF);

SRSPrintDestinationSettings.emailTo("abc@xyz.com");
SRSPrintDestinationSettings.emailSubject("PO");
SRSPrintDestinationSettings.fileName("PO");

SRSPrintDestinationSettings.parmEMailContract();
controller.parmReportContract().parmPrintSettings(SRSPrintDestinationSettings);

controller.runReport();

SysEmailItemId nextEmailItemId;
nextEmailItemId = EventInbox::nextEventId();

outgoingEmailTable.EmailItemId = nextEmailItemId;
outgoingEmailTable.IsSystemEmail = NoYes::No;
outgoingEmailTable.Sender = SysEmailParameters::find().SMTPUserName;
outgoingEmailTable.SenderName = SysEmailParameters::find().SMTPUserName;
outgoingEmailTable.Recipient = hcmWorker.email();
outgoingEmailTable.Subject = "Purchase Order";
outgoingEmailTable.Priority = eMailPriority::Normal ;
outgoingEmailTable.WithRetries = false;
outgoingEmailTable.RetryNum = 0;
outgoingEmailTable.UserId = curUserId();
outgoingEmailTable.Status = SysEmailStatus::Sent;
outgoingEmailTable.LatestStatusChangeDateTime = DateTimeUtil::getSystemDateTime();
outgoingEmailTable.insert();

}

I wrote this code on the clicked event handler, I have the requirement to send the purchase order to the requisitionist, I am getting error "Parameter executionInfo cannot be null or empty.". For right now I have just removed the code to get the email ID of the requisitionist.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Which line of code throws the exception?

  • WillWU Profile Picture
    22,361 on at

    Hi Muhammad,

    The SrsReportDataContract.parmReportExecutionInfo() method need a parameter.

    Please try to change 

     reportExecutionInfo = controller.parmReportContract().parmReportExecutionInfo() as SrsPrintMgmtExecutionInfo;
    
        if (!reportExecutionInfo)
        {
            reportExecutionInfo = new SrsPrintMgmtExecutionInfo();
        }

    to 

    Controller.parmReportContract().parmReportExecutionInfo(new SrsPrintMgmtExecutionInfo());

  •  Muhammad Bilal 17 Profile Picture
    110 on at

    Hi Martin,

    Its run report();

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans