Показать сообщение отдельно
Старый 24.11.2012, 17:42   #1  
PavelX is offline
PavelX
MCTS
MCBMSS
 
46 / 97 (4) ++++
Регистрация: 08.09.2006
Адрес: Красноярск
AX2012 корректная инициализация параметров отчета (SSRS)
Добрый день!

Есть AX2012, в ней стандартный SSRS отчет CustCollectionJour. Необходимо отсылать этот отчет по e-mail, соответственно без диалога. Когда этот отчет печатаешь нормально с диалогом - все ок. Когда отчет вызываешь без диалога и он уже печатался до этого (то есть имеет lastvalues записанные) - все тоже ок. Но когда его без диалога вызываешь на свежей базе (или с удаленными данными пользователя) вываливается такая ошибка:

This report requires a default or user-defined value for the report parameter 'BillingClassification'. To run or subscribe to this report, you must provide a parameter value.

Этот параметр стандартный закрыт конфигурационным ключем Public Sector, который неактивен. Попытки передать параметр при помощи контракта успеха по неизвестной причине не принесли.

Код вызова отчета:


X++:
        controller.parmReportName(
                       PrintMgmtDocType::construct(
                              PrintMgmtDocumentType::CustCollectionLetter
                       ).getDefaultReportFormat());

        args.record(this.parmCustCollectionLetterJour());
        controller.parmArgs(args);

        //  Вот это пробовал  -  не помогло ->
        contract = controller.parmReportContract().parmRdpContract() as CustCollectionJourContract;
        if (isConfigurationkeyEnabled(configurationKeyNum(PublicSector)) 
        && this.parmCustCollectionLetterJour().CustBillingClassification)
        {
            custBillingClassification   = CustBillingClassification::find(
                                this.parmCustCollectionLetterJour().CustBillingClassification
                                );
            if(custBillingClassification)
            {
                billingClassificationList = new List(Types::String);
                billingClassificationList.addEnd(custBillingClassification.BillingClassification);
                contract.parmBillingClassification(billingClassificationList);
            }
        }
        else
        {
            billingClassificationList = new List(Types::String);
            billingClassificationList.addEnd('None');                      // <- dummy test value
            contract.parmBillingClassification(billingClassificationList);
        }
        // <- Вот это пробовал  -  не помогло
        
        // find related customer's contacts
        custTable               = CustTable::find(this.parmCustCollectionLetterJour().AccountNum);
        custCollectionsContact  = CustCollectionsContact::find(custTable.AccountNum);
        contactPerson           = ContactPerson::find(custCollectionsContact.ContactPersonId);
        dirPartyLocation        = DirPartyLocation::findPrimaryPartyLocation(
          contactPerson.DirPartyTable().RecId, 
          false, 
          LogisticsElectronicAddressMethodType::Email);
        if (dirPartyLocation.RecId == 0)
        {
            throw error(strFmt("@AAAXX", custTable.AccountNum));
        }
        logisticsElectronicAddress = LogisticsElectronicAddress::findByLocation(dirPartyLocation.Location);

        // create email contract
        emailContract = new SrsReportEMailDataContract();

        // fill in the email contract details
        emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
        emailContract.parmSubject(this.parmCustCollectionLetterJour().NewMailReference);
        emailContract.parmBody(this.parmCustCollectionLetterJour().NewMailText);
        emailContract.parmTo(logisticsElectronicAddress.Locator);

        // get print settings from contract
        printSettings = controller.parmReportContract().parmPrintSettings();

        // update print settings with email contract and use pdf format in the attachment
        printSettings.printMediumType(SRSPrintMediumType::Email);
        printSettings.parmEMailContract(emailContract);
        printSettings.fileFormat(SRSReportFileFormat::PDF);

        // suppress the parameter dialog
        controller.parmShowDialog(false);

        //send e-mail
        controller.startOperation();
Подскажите пожалуйста как корректно передать этот параметр, по возможности не меняя сам отчет и сопутствующие ему классы? Спасибо.

Последний раз редактировалось PavelX; 24.11.2012 в 17:46.