Showing posts with label Dynamics Report. Show all posts
Showing posts with label Dynamics Report. Show all posts

Tuesday, June 27, 2017

Deploy Report through x++ code

Here is the code to deploy SSRS report in Microsoft Dynamics AX.

static void deployReport(Args _args)
{
    SRSReportManager srsRptMgr = new SRSReportManager();
    SSRSReportConceptNode node = new SSRSReportConceptNode();

    node = TreeNode::findNode(@"\\SSRS Reports\Reports\SalesInvoice");

    srsRptMgr.deploymentStart();
    srsRptMgr.deployReport(node);
    srsRptMgr.deploymentEnd();
}

Error 1 Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

You get the error when trying to deploy a report either by using VS2013 reporting tool or through AOT


The "GenerateRdlTask" task failed unexpectedly.
System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Resolution:
1. Go to Control Panel\System and Security\System
2. Open Advanced system settings and open Environment Variables
3. Create a New Variable
4.Variable name: COMPLUS_LoaderOptimization ; Variable value: 1
5. Click OK
6. Logout from the server and logon again.
7. Open the report using Visual Studio 2013 and deploy the AX report.
8. The report can also be deployed from AOT


Update label description using X++

I have requirement where i need to update label for ssrs report parameter

Here is my solution for updating label

static void updateLabelJob(Args _args)
{
    SysLabelEdit     sysLabelEditLocal;
 
    sysLabelEditLocal = new sysLabelEdit();

    info(strFmt('Before Label changes : %1', "@DAN1"));
 
    sysLabelEditLocal.labelModify('en-us',  sysLabelEditLocal.findLabel('en-us', 'Demo Parameter'),                                                          "SSRSTEST", "", SysLabelApplModule::None);
 
    info(strFmt('After Label changes : %1', "@IQL112"));
}