How to find those record that are modified on certain date from a certain table.

When i started working this, i thought it would be task like a click, because i was making logic in my mind to compare the CreatedDateTime field with today’s value (CreatedDateTime >= today()) but when i wrote this i got into trouble, as the compiler is not allowing me and give me error. The error suggest me that i need to convert the date to dateTime then i can use this in select to get my desired result. Not only i need to convert the date to dateTime but i also needs the gets min and max dateTime of todays date.

I open the most important GLOBAL class in AX and luckily i found methods there

datetobeginUtcDateTime(_currDate, _tz),
msdn description of the method: Retrieves a utcdatetime value that represents the beginning of the specified date.

_currDate :The date to retrieve the beginning of.
_tz : The time zone to use to find the start of the date
datetoendUtcDateTime(_currDate, _tz),
msdn description of the method:
 Retrieves a utcdatetime value that represents the end of the specified date.

_currDate :The date to retrieve the end of.
_tz : The time zone to use to find the end of the date
After finding the above method to get the min and max datetime for the todays date, i can use them in the select to get userLog record created today.

select * from log
where log.CreatedDateTime >= datetobeginUtcDateTime(today(), DateTimeUtil::getUserPreferredTimeZone()) &&
log.CreatedDateTime <= datetoendUtcDateTime(today(), DateTimeUtil::getUserPreferredTimeZone());

Link – https://msdax.wordpress.com/2011/04/26/how-to-find-those-record-that-are-modified-on-certain-date-from-a-certain-table/

Implementing table extension framework in Dynamics AX 2012 [SalesLine]

To implement the table extension framework in Dynamics AX  2012 R3, following are the steps:

Assume that you have table SalesLine and you want to make extension table ISPLSalesLineExtension.

Step – 1: Add Relation

At SalesLineExtension table, add new relation named SalesLine, table SalesLine.

Add a new field ForeignKey -> PrimaryKey based at newly created ISPLSalesLineExtension table. Reference field to the primary table will be added automatically.TEF-2TEF-1

Note: if the parent table’s primary key is not RecId-based, but the table has CreateRecIdIndex property set to Yes, then the relation on step #1 should be created based on “Single field AlternateKey based”; otherwise the new field will potentially have wrong type, and it will not be possible to use it in the SysExtensionSerializerExtensionMap map.

Step – 2:  Create a unique index for the reference field that points back to SalesLine .
TEF-2
Step – 3 Integrate with the table extensions framework

Add parent table (SalesLine – If it is standard table it might already be exist) to SysExtensionSerializerMap and child table (ISPLSalesLineExtension) to SysExtensionSerializerExtensionMap

TEF-3.1

TEF-3.2

TEF-3.3

TEF-3.4

 

Step – 4: Create methods at ISPLSalesLineExtension table
TEF-4.1
TEF-4.2
TEF-4.3
TEF-4.4
Step – 5: Create new field PackedExtensions in SalesLine.

This field is available in standard table (Check if already exists)

TEF-5

Step – 6: Add a delete action from the SalesLine to the ISPLSalesLineExtension table.
TEF-6
Step – 7:  Create/Update methods at SalesLine table
TEF-7.1
TEF-7.2
Step – 8: Modify below methods on parent table. (SalesLine)

Check if code already exists if it is a standard table.

public void insert()

{

super();

this.SysExtensionSerializerMap::postInsert();

}

public void update()

{

super();

this.SysExtensionSerializerMap::postUpdate();

}

Step – 9: Please be aware that write method of parent data source (SalesLine) should be modified:

 public void write()

{

super();

ISPLSalesLineExtension.SysExtensionSerializerExtensionMap::insertAfterBaseTable(SalesLine);

}

Write Method of child table triggers first and as a result child record will not be saved as it’s insert and update methods does not allow it without correct foreign key.

Step – 10: Modify Form Code as per below

TEF-10.1

TEF-10.2

TEF-10.7

TEF-10.6

TEF-10.5

TEF-10.4

TEF-10.3

 

Link – http://www.intech-systems.com/table-extension-framework-dynamics-ax/

Other – http://daxonline.org/9-table-extension-framework.html

Creating Vendors thru X++ in AX 2012

1.

//Create party for the vendor

public void createParty(VendorRequestCreate          _vendorRequestCreate)

{

;

if(_vendorRequestCreate.DirPartyType        == DirPartyBaseType::Person)

{

dirPerson.Name                          = _vendorRequestCreate.VendorName;

dirPerson.NameAlias                     = _vendorRequestCreate.FirstName;

dirPerson.NameSequence                  = dirNameSequence::find(‘First Last’).RecId;

dirPerson.insert();

dirPersonName.FirstName                 = _vendorRequestCreate.FirstName;

dirPersonName.MiddleName                = _vendorRequestCreate.MiddleName;

dirPersonName.LastName                  = _vendorRequestCreate.LastName;

dirPersonName.ValidFrom                 = DateTimeUtil::newDateTime(systemDateGet(),str2time(’00:00:00′),DateTimeUtil::getUserPreferredTimeZone());

dirPersonName.ValidTo                   = DateTimeUtil::maxValue();

dirPersonName.Person                    = dirPerson.RecId;

dirPersonName.insert();

dirParty                                = new DirParty(dirPerson);

}

else

{

dirOrganisation.Name                    = _vendorRequestCreate.VendorName;

dirOrganisation.NameAlias               = _vendorRequestCreate.FirstName;

dirOrganisation.LanguageId              = ‘EN-US’;

dirOrganisation.KnownAs                 = _vendorRequestCreate.VendorName;

dirOrganisation.PhoneticName            = _vendorRequestCreate.VendorName;

dirOrganisation.insert();

dirParty                                = new DirParty(dirOrganisation);

}

}

2.

//Create vendor and associate with vendor

public void convertToVendor(VendorRequestCreate          _vendorRequestCreate)

{

VendorRequestCreate                  vendorRequestCreate = VendorRequestCreate::find(_vendorRequestCreate.VendorNo,true);

;

if(_vendorRequestCreate.DirPartyType    == DirPartyBaseType::Person)

vendTable.Party         = dirPerson.RecId;

else

vendTable.Party         = dirOrganisation.RecId;

ttsBegin;

vendTable.AccountNum    = NumberSeq::newGetNum(VendParameters::numRefVendAccount()).num();

ttsCommit;

if(vendTable.AccountNum == ”)

vendTable.AccountNum= int2str(_vendorRequestCreate.VendorNo);

vendTable.Currency      = _vendorRequestCreate.CurrencyCode;

vendTable.VendGroup     = _vendorRequestCreate.VendGroupId;

vendTable.PaymTermId    = _vendorRequestCreate.PaymTermId;

vendTable.DefaultDimension = _vendorRequestCreate.DefaultDimension;

vendTable.OneTimeVendor = _vendorRequestCreate.OneTimeSupplier;

vendTable.PaymMode      = _vendorRequestCreate.PaymMode;

vendTable.BankAccount   = _vendorRequestCreate.BankAccount;

vendTable.WI_Remarks    = _vendorRequestCreate.Remarks;

vendTable.WI_DepartmentEmail = _vendorRequestCreate.DepartmentEmail;

vendTable.insert();

this.createPostalAddress(_vendorRequestCreate);

this.createCommAddress(_vendorRequestCreate);

this.createBankDetails(_vendorRequestCreate,vendTable.AccountNum);

this.createContact(_vendorRequestCreate,vendTable.Party);

if(vendTable.RecId)

{

vendorRequestCreate.VendAccount = vendTable.AccountNum;

vendorRequestCreate.update();

info(strFmt(‘Vendor %1 has been successfully created’,vendTable.AccountNum));

}

}

3.

//Create postal address

public void createPostalAddress(VendorRequestCreate          _vendorRequestCreate)

{

VendorRequestAddress             vendorRequestAddress;

DirPartyPostalAddressView           dirPartyPostalAddressView;

;

select Addressing, LogisticsAddressCity, LogisticsAddressCountryRegionId, LogisticsAddressStateId,

LogisticsAddressZipCodeId from vendorRequestAddress

where vendorRequestAddress.WI_VendorRequestCreate       == _vendorRequestCreate.RecId;

// Create postal address

if(dirPerson.RecId || dirOrganisation.RecId)

{

dirPartyPostalAddressView.LocationName                  = ‘Primary business’;

dirPartyPostalAddressView.Address                       = vendorRequestAddress.Addressing;

dirPartyPostalAddressView.City                          = vendorRequestAddress.LogisticsAddressCity;

dirPartyPostalAddressView.ZipCode                       = vendorRequestAddress.LogisticsAddressZipCodeId;

dirPartyPostalAddressView.State                         = vendorRequestAddress.LogisticsAddressStateId;

dirPartyPostalAddressView.Street                        = vendorRequestAddress.Addressing;

//dirPartyPostalAddressView.Street                        = ‘Dover Street’;

//dirPartyPostalAddressView.StreetNumber                  = ‘123’;

dirPartyPostalAddressView.CountryRegionId               = vendorRequestAddress.LogisticsAddressCountryRegionId;

dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);

}

}

4.

//Create communication details

public void createCommAddress(VendorRequestCreate          _vendorRequestCreate)

{

VendorRequestCommunication       vendorRequestCommunication;

;

select Phone1, Phone2, Email, Fax from vendorRequestCommunication

where vendorRequestCommunication.WI_VendorRequestCreate == _vendorRequestCreate.RecId;

//Phone 1

if(vendorRequestCommunication.Phone1 != ” && vendTable.Party != 0)

{

logisticsLocation.clear();

logisticsLocation   = LogisticsLocation::create(‘Phone’, NoYes::No);

dirPartyContactInfoView.LocationName                = ‘Primay Phone 1’;

dirPartyContactInfoView.Locator                     = vendorRequestCommunication.Phone1;

dirPartyContactInfoView.Type                        = LogisticsElectronicAddressMethodType::Phone;

dirPartyContactInfoView.Party                       = vendTable.Party;

dirPartyContactInfoView.IsPrimary                   = NoYes::Yes;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

//Phone 2

if(vendorRequestCommunication.Phone2 != ” && vendTable.Party != 0)

{

logisticsLocation.clear();

logisticsLocation   = LogisticsLocation::create(‘Phone’, NoYes::No);

dirPartyContactInfoView.LocationName                = ‘Primay Phone 2’;

dirPartyContactInfoView.Locator                     = vendorRequestCommunication.Phone2;

dirPartyContactInfoView.Type                        = LogisticsElectronicAddressMethodType::Phone;

dirPartyContactInfoView.Party                       = vendTable.Party;

dirPartyContactInfoView.IsPrimary                   = NoYes::No;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

//Email

if(vendorRequestCommunication.Email != ” && vendTable.Party != 0)

{

logisticsLocation.clear();

logisticsLocation   = LogisticsLocation::create(‘Phone’, NoYes::No);

dirPartyContactInfoView.LocationName                = ‘Primay Email’;

dirPartyContactInfoView.Locator                     = vendorRequestCommunication.Email;

dirPartyContactInfoView.Type                        = LogisticsElectronicAddressMethodType::Email;

dirPartyContactInfoView.Party                       = vendTable.Party;

dirPartyContactInfoView.IsPrimary                   = NoYes::Yes;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

//Fax

if(vendorRequestCommunication.Fax != ” && vendTable.Party != 0)

{

logisticsLocation.clear();

logisticsLocation   = LogisticsLocation::create(‘Phone’, NoYes::No);

dirPartyContactInfoView.LocationName                = ‘Primay Fax’;

dirPartyContactInfoView.Locator                     = vendorRequestCommunication.Fax;

dirPartyContactInfoView.Type                        = LogisticsElectronicAddressMethodType::Fax;

dirPartyContactInfoView.Party                       = vendTable.Party;

dirPartyContactInfoView.IsPrimary                   = NoYes::Yes;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

}

5.

//Create bank details for the vendor

private void createBankDetails(WI_VendorRequestCreate          _vendorRequestCreate,

VendAccount                     _vendAcc)

{

VendBankAccount         vendBankAccount;

LogisticsLocation       lLogisticsLocation;

LogisticsPostalAddress  logisticsPostalAddress;

;

ttsBegin;

lLogisticsLocation.Description      = _vendorRequestCreate.FirstName;

lLogisticsLocation.insert();

logisticsPostalAddress.Street       = _vendorRequestCreate.VendBankAddress;

logisticsPostalAddress.Address      = _vendorRequestCreate.VendBankAddress;

logisticsPostalAddress.Location     = lLogisticsLocation.RecId;

logisticsPostalAddress.insert();

vendBankAccount.AccountID           = subStr(_vendorRequestCreate.BankAccount,1,10);

vendBankAccount.Name                = _vendorRequestCreate.BankAccount;

vendBankAccount.AccountNum          = _vendorRequestCreate.BankAccountNum;

vendBankAccount.VendAccount         = _vendAcc;

vendBankAccount.CurrencyCode        = _vendorRequestCreate.CurrencyCode;

vendBankAccount.BankGroupID         = BankAccountTable::find(vendBankAccount.AccountID).BankGroupId;

vendBankAccount.Location            = lLogisticsLocation.RecId;

vendBankAccount.WI_BeneficiaryName  = _vendorRequestCreate.BeneficiaryName;

vendBankAccount.initFromBankGroup(BankGroup::find(vendBankAccount.BankGroupID));

vendBankAccount.insert();

ttsCommit;

}

6.

//Create contact for the vendor

private void createContact(VendorRequestCreate       _vendorRequestCreate,

RefRecId                     _partyId)

{

ContactPerson           contactPerson;

DirPersonName           lDirPersonName;

DirPerson               lDirPerson;

DirParty                lDirParty;

LogisticsLocation       lLogisticsLocation;

DirPartyContactInfoView             lDirPartyContactInfoView;

;

//Create party for Contact

lDirPerson.Name                          = _vendorRequestCreate.ContactPersonName;

lDirPerson.NameAlias                     = _vendorRequestCreate.ContactPersonName;

lDirPerson.NameSequence                  = dirNameSequence::find(‘First Last’).RecId;

lDirPerson.insert();

lDirPersonName.FirstName                 = _vendorRequestCreate.ContactPersonName;

//lDirPersonName.MiddleName                = _vendorRequestCreate.ContactPersonName;

//lDirPersonName.LastName                  = _vendorRequestCreate.LastName;

lDirPersonName.ValidFrom                 = DateTimeUtil::newDateTime(systemDateGet(),str2time(’00:00:00′),DateTimeUtil::getUserPreferredTimeZone());

lDirPersonName.ValidTo                   = DateTimeUtil::maxValue();

lDirPersonName.Person                    = lDirPerson.RecId;

lDirPersonName.insert();

lDirParty                                = new DirParty(lDirPerson);

//Create contact and associate with party

contactPerson.ContactForParty           = vendTable.Party;

contactPerson.Party                     = lDirPerson.RecId;

contactPerson.insert();

//Create contact number

if(_vendorRequestCreate.ContactPersonNo != ”)

{

lLogisticsLocation.clear();

lLogisticsLocation                  = LogisticsLocation::create(‘Phone’, NoYes::No);

lDirPartyContactInfoView.LocationName                = ‘Primay Phone’;

lDirPartyContactInfoView.Locator                     = _vendorRequestCreate.ContactPersonNo;

lDirPartyContactInfoView.Type                        = LogisticsElectronicAddressMethodType::Phone;

lDirPartyContactInfoView.Party                       = contactPerson.Party;

lDirPartyContactInfoView.IsPrimary                   = NoYes::Yes;

lDirParty.createOrUpdateContactInfo(lDirPartyContactInfoView);

}

}

How to get Company information using X++ code in Ax 2012

static void CompanyInformation(Args _args)
{
CompanyInfo     Company;
;
Company = CompanyInfo::find();
info(strFmt(“Company Name : %1”, Company.Name));
info(strFmt(“Company Phone : %1”, Company.phone()));
info(strFmt(“Company Phone : %1”, Company.telefax()));
info(strFmt(“Company Address : %1”, Company.postalAddress().Address));
}
How to get Company full name using x++ code 
str     countryName;

countryName= logisticsAddressCountryRegion::name(countryRegionId);

Company Tax details using X++ code
IEC
display TaxRegistrationNumber_IN  tax_IEC()
{
TaxInformation_IN        taxInformation_IN;

taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

return TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
}

Service Tax (STC)
display TaxRegistrationNumber_IN  tax_STC()
{
TaxInformation_IN        taxInformation_IN;

taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

return TaxRegistrationNumbers_IN::find(taxInformation_IN.STCRegistrationNumberTable).RegistrationNumber;

}

Tax Identification number (TIN)
display TaxRegistrationNumber_IN  tax_TIN()
{
TaxInformation_IN        taxInformation_IN;

taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

return TaxRegistrationNumbers_IN::find(taxInformation_IN.TIN).RegistrationNumber;

}

Tax Account number(TAN) or PAN

display TaxRegistrationNumber_IN  tax_TAN()
{
TaxInformation_IN           taxInformation_IN;
utcDateTime                 fromDate, toDate;
TaxRegistrationNumbers_IN   TaxRegistrationNumbers_IN;

fromDate = DateTimeUtil::getSystemDateTime();
toDate = DateTimeUtil::maxValue();

taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocationAndValidDateTime_IN(this.PrimaryAddressLocation, fromDate, toDate).Location);
select firstFast TaxRegistrationNumbers_IN
where TaxRegistrationNumbers_IN.RecId   == taxInformation_IN.TAN
&&   TaxRegistrationNumbers_IN.TaxType == TaxType_IN::None;

return TaxRegistrationNumbers_IN.RegistrationNumber;
}

For multiple Phone numbers and fax Details

static void Companywithmultiplephonenumber(Args _args)
{

DirPartyContactInfoView         contactInfoView;
CompanyInfo companyinfo;

companyinfo = CompanyInfo::find();
info(strfmt(“%1”,companyinfo.Name));

while  select  contactInfoView
where
contactInfoView.Type == LogisticsElectronicAddressMethodType::Phone
|| contactInfoView.Type == LogisticsElectronicAddressMethodType::Fax
&& contactInfoView.Party == companyinfo.RecId
{

if(contactInfoView.Type == LogisticsElectronicAddressMethodType::Phone)
{
info(strFmt(“Description – %1   Phone –             %2”,contactInfoView.LocationName,contactInfoView.Locator));
}
else
{
info(strFmt(“Description – %1   Fax – %2″,contactInfoView.LocationName,contactInfoView.Locator));
}
}
}

static void CompanyInfo(Args _args)
{
DirPartyContactInfoView         contactInfoView,contactInfoPhone,contactInfoFax;
Name                            LocationName,Phone,Fax;
description255                  contactAddress;
CompanyInfo                     companyInfo = CompanyInfo::find();
container                       CompanyLogo = FormLetter::companyLogo();
Name                            PrintedBy   = xUserInfo::find(false,curUserId()).name;

while  select contactInfoView group by LocationName
where contactInfoView.Party == companyinfo.RecId
{
LocationName = contactInfoView.LocationName;

select contactInfoPhone where contactInfoPhone.Party == companyinfo.RecId
&& contactInfoPhone.Type == LogisticsElectronicAddressMethodType::Phone
&& contactInfoPhone.LocationName == LocationName;

if(contactInfoPhone)
{
Phone     = contactInfoPhone.Locator;
}
select contactInfoFax where contactInfoFax.Party == companyinfo.RecId
&& contactInfoFax.Type == LogisticsElectronicAddressMethodType::Fax
&& contactInfoFax.LocationName == LocationName;

if(contactInfoFax)
{
Fax       = contactInfoFax.Locator;
}

contactAddress += LocationName + ” Tel: ” + Phone + ” Fax: ” + Fax + ” ” +’\n’;

}
info(strFmt(“ContactAddress = %1 , ExcutedBy = %2”,contactAddress,PrintedBy));
}

How to change Purchase Order Confirmation report design with your own design in X++?

How can we override Purchase Order Confirmation report design with our own report and design in X++?

To do so, it has two methods you need to change, one is mandatory and another one is needed only if you use Print Management. They are local function loadPrintSettings.setSettingDetail in FormLetterReport class and local function getSettings.makeSettingDetail in PrintMgmt class.

For FormLetterReport class, the code is something like below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public void loadPrintSettings(Common _jourTable, Common _transTable, str _languageId, str _documentKeyValue = '')
{
    //.....
    void setSettingDetail(PrintMgmtDocInstanceType _type, SRSPrintDestinationSettings _defaultSettings)
    {
        PrintMgmtPrintSettingDetail printSettingDetail = new PrintMgmtPrintSettingDetail();
        //.....
            printSettingDetail.parmReportFormatName(PrintMgmtReportFormat::findSystem(this.getPrintMgmtDocumentType()).Name);
            //Override here
            if(printMgmtReportRun.parmDocType() == PrintMgmtDocumentType::PurchaseOrderRequisition)
            {
                printSettingDetail.parmReportFormatName(ssrsReportStr(YourNewPurchPurchaseOrderReport, YourDesign));
            }
        //.....
    }
    //.....
}

Finally, you need to make the modification at local function getSettings.makeSettingDetail in PrintMgmt class if using Print Management.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public static PrintMgmtPrintSetting getSettings(PrintMgmtPrintContext _printContext)
{
    //.....
    PrintMgmtPrintSettingDetail makeSettingDetail(PrintMgmtSetupSettings _setupSettings)
    {
        PrintMgmtPrintSettingDetail newSettingDetail = new PrintMgmtPrintSettingDetail();
        //.....
        newSettingDetail.parmReportFormatName(PrintMgmtReportFormat::findWithSystem(_setupSettings.parmReportFormat(), instance.parmParent().parmDocumentType()).Name);
        //Override here
        if(instance.parmParent().parmDocumentType() == PrintMgmtDocumentType::PurchaseOrderRequisition)
        {
            newSettingDetail.parmReportFormatName(ssrsReportStr(YourNewPurchPurchaseOrderReport, YourDesign));
        }
        //.....
    }
    //.....
}

Alternately, you can override the PurchPurchaseOrderController.outputReport method like the one in Sales Invoice report (create a new override method if not exist).

How to override Sales Invoice report with custom report?

How to change/replace/override Sales Invoice report with new report/design? There are one main thing you need to change in order to change to new report/design. It is override the SalesInvoiceController.outputReport method. Please refer to code below:

1
2
3
4
5
6
7
8
9
10
//SalesInvoiceController class
protected void outputReport()
{
    //....
    PrintMgmtPrintSettingDetail detail = formLetterReport.getCurrentPrintSetting();
    //....
    //At the end of the code
    detail.parmReportFormatName(ssrsReportStr(SalesInvoice, YourNewDesign));
}

If you want further control what report you want to print, you can change the main method code in SalesInvoiceController, the Sales Invoice menu by passing correct argument to the menu, and finally add logic to control what report to print in outputReport method above. For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//SalesInvoiceController class
public static void main(Args _args)
{
    //....
    if (_args.parmEnumType() == enumNum(MyReportType))
    {
        if (_args.parmEnum() == MyReportType::Invoice)formLetterController.parmReportType(MyReportType::Invoice);
    }
    _args.parmEnumType(enumNum(PrintCopyOriginal));
    _args.parmEnum(PrintCopyOriginal::Original);
    //Original code
    formLetterController.parmShowDialog(false);
    formLetterController.startOperation();
}   

Changing report design via code SSRS – Print Management

  • Added a new design in report on SSRS and redeployed report
  • Override method OutputReport on report controller class, with code as under
  • Wrote following code for testing
protected void outputReport()
{
SRSCatalogItemName          reportDesign;
Dialog                      smcdialog;
DialogField                 dfNewDesign;
NoYesId                     getDecision = NoYes::No;

;

smcdialog = new Dialog('Test dialog');
dfNewDesign =  smcdialog.addField(extendedTypeStr(NoYesId),"Should i run new design??? Mark me if you want so, elase leave me as it is.");
    
if(smcdialog.run())
{
    getDecision = dfNewDesign.value();
}

if(getDecision == NoYes::Yes)
{
    reportDesign = 'SalesPackingSlip.NewDesign1';
}
else
{
    reportDesign = this.parmReportName();
}
    
this.parmReportName(reportDesign);
this.parmReportContract().parmReportName(reportDesign);

formLetterReport.parmReportRun().settingDetail().parmReportFormatName(reportDesign);
    
super();
    
}
  • Generated incremental CIL
  • Run testing

    It worked perfectly

    Despite of all the discussion and providing step by step, if you cannot do it, sorry I cannot help you anymore. There is another option to contact Microsoft support. You may opt for that.


Link 2:

It is one of the normal development requirements you may came across where you want to change the report design name on the basis of some logic. The following example shows you how to achieve this.

The modification is done in Controller class “outputReport” method, before “super” call you need to set the updated design name based on some condition and its done.

/// <summary>
///    Executes the report for the print management setting that is currently loaded.
/// </summary>
/// <remarks>
///    The <c>outReports</c> method loops over print management settings and calls this method for each
///    print management setting loaded.
/// </remarks>
/// <exception cref=”M:Exception::Error”>
///    The print management object has not been initialized.
/// </exception>
public void outputReport()
{
reportDesign = ‘MyReport.Report_DesignA’;
this.parmReportName(reportDesign);
this.parmReportContract().parmReportName(reportDesign);
formLetterReport.parmReportRun().settingDetail().parmReportFormatName(reportDesign);
super();
}


Link 3:

Use the following code in outputReport() method in your controller class.

public void outputReport()

{

reportDesign = ‘MyReport.Report_DesignA’;

this.parmReportName(reportDesign);

this.parmReportContract().parmReportName(reportDesign);

formLetterReport.parmReportRun().settingDetail().parmReportFormatName(reportDesign);

super();

}

For details please check out the following link:

thinkinginax.blogspot.com/…/changing-report-design-via-code-ssrs.html