Tuesday, 22 October 2019

D365 F & O + Dynamics Ax Get Dimension Attribute Value using X++ coding

 1. Get Dimension values
public static String255 getDimensionValue(SalesLine     _salesLine,Name _attributeValue)
    {
        ProjTable                            ProjTable;
        DimensionAttributeValueSet         DimensionAttributeValueSet;
        DimensionAttributeValueSetItem     DimensionAttributeValueSetItem;
        DimensionAttributeValue            DimensionAttributeValue;
        DimensionAttribute                 DimensionAttribute;

        //  To display value for ProjectId "10005" only
        select RecId from DimensionAttributeValueSet
                where  DimensionAttributeValueSet.RecId == _salesLine.DefaultDimension
        join RecId, DisplayValue from DimensionAttributeValueSetItem
                where DimensionAttributeValueSetItem.DimensionAttributeValueSet == DimensionAttributeValueSet.RecId
        join RecId from DimensionAttributeValue
                where DimensionAttributeValue.RecId == DimensionAttributeValueSetItem.DimensionAttributeValue
        join RecId, Name from DimensionAttribute
                where DimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute
                && DimensionAttribute.Name == _attributeValue; //'Cost Center';
       
        return DimensionAttributeValueSetItem.DisplayValue;
    }

#D365 FO #X++ #Dynamics Ax

Monday, 20 October 2014

while Importting Ax 2012 r3 contoso data Error

while Importting Ax 2012 r3 contoso data  Error

Unhandled Exception: System.NotSupportedException: The given path's format is no
t supported.
   at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boo
lean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[
] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, AccessControlActions control, String[] pathListOrig, Boolean check
ForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFul
lPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String origina
lUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`
1 resultHandler, Boolean checkHost)
   at System.IO.Directory.InternalGetFileDirectoryNames(String path, String user
PathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, S
earchOption searchOption, Boolean checkHost)
   at System.IO.Directory.InternalGetFiles(String path, String searchPattern, Se
archOption searchOption)
   at Microsoft.Dynamics.AX.Dataport.SqlHelper.GetDifferentialTableNames(Datapor
tDatabase db, String directory) in e:\bt\110700\Source\DataPort\Dataport\Library
\SqlHelper.cs:line 721
   at DP.Program.Execute(String currentDirectory, DataportDirection direction, S
tring directory, String database, String server, DataportAction action) in e:\bt
\110700\Source\DataPort\DP\Program.cs:line 183
   at DP.Program.Main(String[] args) in e:\bt\110700\Source\DataPort\DP\Program.
cs:line 82


solution : Give the read ,write and DB-owner access of database.

Tuesday, 14 October 2014

Dynamics Ax or D365 F & O SSRS Reports Error

Publish-AXReport : An error occurred : The network path was not found.
If User Account Control (UAC) is enabled on the machine, close the
application, right-click the application, and then click Run  as administrator.
At line:1 char:1
+ Publish-AXReport -ReportName *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Dynam...erConfigura
   tion:VerifyReportServerConfiguration) [Publish-AXReport], InvalidOperation
  Exception
    + FullyQualifiedErrorId : An error occurred : The network path was not fou
   nd.
    If User Account Control (UAC) is enabled on the machine, close the applica
   tion, right-click the application, and then click Run as administrator.,Mi
  crosoft.Dynamics.AX.Framework.Management.Reports.PublishReportCommand

Publish-AXReport : The deployment was aborted. You do not have privileges to
deploy to server: ignblr-pothuraj. For deployment, you must have
administrative rights to the SQL Server Reporting Services (SSRS) server.
Contact your administrator to deploy.
At line:1 char:1
+ Publish-AXReport -ReportName *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (Microsoft.Dynam...ReportsDeploye
   r:ReportsDeployer) [Publish-AXReport], SecurityException
    + FullyQualifiedErrorId : The deployment was aborted. You do not have priv
   ileges to deploy to server: ignblr-pothuraj. For deployment, you must have
   administrative rights to the SQL Server Reporting Services (SSRS) server.
  Contact your administrator to deploy.,Microsoft.Dynamics.AX.Framework.Man
agement.Reports.PublishReportCommand



Solution :
Remote Registry”-service is not enabled by default. After enabling and starting the service via Start -> Administrative Tools -> Services deployment of
 AX 2012 default SRS reports was successful. I suggest changing Start type from Manually to Automatic.




Friday, 10 October 2014

commands for Compilation of Ax2012 R3

 the Bellow commands for Compilation of Ax2012 R3

Open the command prompt  Run as Administrator

C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAXR3\bin\
  axbuild.exe  xppcompileall  /s=01
     /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"


CD  C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAXR3\bin

above the installation of file path.

Cd   axbuild.exe  xppcompileall  /s=01
     /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"


Thursday, 9 October 2014

Date Range query(From date ...Todate ) on MS Dynamics Ax using x++ code

 
    Query                   q;
    QueryBuildDataSource    qbd;
    QueryBuildRange         qbr,qbr1;

   // ret = super();

    q = new Query();
    qbd = q.addDataSource(TableNum( RateLine));
    qbr = qbd.addRange(FieldNum( RateLine, StartDate));
    qbr1 = qbd.addRange(FieldNum( RateLine, InflationTypeID));
    qbr1.value(InflationRate_Type.valueStr());
    qbr.value(strfmt('"%1".."%2"',FromDate.dateValue(), editEndDateRange.dateValue()));
    RateLine_ds.query(q);
    RateLine_ds.executeQuery();

Wednesday, 24 September 2014

How to Import XML file Through X++ coding , SalesOrder XML file How to Import using X++ code

static void SalesOrderCreatandInvoice(Args _args)
{
    RetailTransactionService    RetailTransactionService;
    str   dc;

    XmlDocument doc;
    XmlNodeList data;
    XmlElement nodeTable;
    XmlElement nodeAccount;
    XmlElement nodeName;
    #define.filename(@'C:\Temp\CreateCustomerOrder.xml')
    doc = XmlDocument::newFile(#filename);
    doc.load(@'C:\Temp\CreateCustomerOrder.xml');
   // dc = any2str(doc.lo);

    RetailTransactionService::createCustomerOrder(doc.toString());
}



XML file:

Customer Order / SalesOrder file .

<CustomerOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <AutoPickOrder>false</AutoPickOrder>
  <TransactionId>0000000296</TransactionId>
  <OrderType>SalesOrder</OrderType>
  <Status>0</Status>
  <DocumentStatus>0</DocumentStatus>
  <CustomerAccount>2002</CustomerAccount>
  <AddressRecord>22565427550</AddressRecord>
  <InventLocationId>BOSTON</InventLocationId>
  <StoreId>BOSTON</StoreId>
  <TerminalId>BOSTON-1</TerminalId>
  <TotalManualDiscountAmount>0</TotalManualDiscountAmount>
  <TotalManualDiscountPercentage>0</TotalManualDiscountPercentage>
  <ExpiryDate>2014-09-10</ExpiryDate>
  <HourOfDay>16</HourOfDay>
  <DeliveryMode>60</DeliveryMode>
  <RequestedDeliveryDate>2014-08-11</RequestedDeliveryDate>
  <Comment />
  <PrepaymentAmountOverridden>false</PrepaymentAmountOverridden>
  <PrepaymentAmountApplied>95.61</PrepaymentAmountApplied>
  <PreviouslyInvoicedAmount>0</PreviouslyInvoicedAmount>
  <SalespersonStaffId>000137</SalespersonStaffId>
  <CurrencyCode>USD</CurrencyCode>
  <LoyaltyCardId />
  <HasLoyaltyPayment>false</HasLoyaltyPayment>
  <ChannelReferenceId>STONON-1300001</ChannelReferenceId>
  <Email>marykay@contoso.com</Email>
  <Items>
    <Item ItemId="0061" RecId="0" Quantity="1" QuantityPicked="0" Unit="ea" Price="24.9900000000000000" Discount="0" DiscountPercent="0" NetAmount="24.99" Comment="" TaxGroup="MA" TaxItemGroup="RP" SalesMarkup="0" Status="0" InventLocationId="BOSTON" DeliveryMode="60" RequestedDeliveryDate="2014-08-11" AddressRecord="22565427550" BatchId="" SerialId="" VariantId="" LineDscAmount="0" PeriodicDiscount="0" PeriodicPercentageDiscount="0" LineManualDiscountAmount="0" LineManualDiscountPercentage="0" TotalDiscount="0" TotalPctDiscount="0" IgnDeliveryTime="00:00:00">
      <Charges />
      <Discounts />
      <Salespersons>
        <Salesperson SalespersonId="000100" SalespersonName="Josh Edwards" />
        <Salesperson SalespersonId="000155" SalespersonName="Renata Krausova" />
      </Salespersons>
    </Item>
    <Item ItemId="0066" RecId="0" Quantity="1" QuantityPicked="0" Unit="ea" Price="74.9900000000000000" Discount="0" DiscountPercent="0" NetAmount="74.99" Comment="" TaxGroup="MA" TaxItemGroup="RP" SalesMarkup="0" Status="0" InventLocationId="BOSTON" DeliveryMode="60" RequestedDeliveryDate="2014-08-11" AddressRecord="22565427550" BatchId="" SerialId="" VariantId="" LineDscAmount="0" PeriodicDiscount="0" PeriodicPercentageDiscount="0" LineManualDiscountAmount="0" LineManualDiscountPercentage="0" TotalDiscount="0" TotalPctDiscount="0" IgnDeliveryTime="00:00:00">
      <Charges />
      <Discounts />
      <Salespersons>
        <Salesperson SalespersonId="000110" SalespersonName="Dan Park" />
        <Salesperson SalespersonId="000111" SalespersonName="Patrick Elliot" />
        <Salesperson SalespersonId="000120" SalespersonName="Andrew Lan" />
        <Salesperson SalespersonId="000137" SalespersonName="Emma Harris" />
      </Salespersons>
    </Item>
  </Items>
  <Charges />
  <Payments>
    <Payment PaymentType="1" Amount="10.62" Currency="" Prepayment="false" />
  </Payments>
  <Affiliations />
</CustomerOrder>