Quantcast
Channel: Martin Dráb's Activities
Viewing all 17532 articles
Browse latest View live

Posting a Sales Order with parameters

$
0
0

I'm trying to create a sales order in x++ 2012 r2 and invoice. I can get it to invoice fine, but i want to be able to set the Document Date: which sales its set in SalesParmTable.
I can set the parameters below for salesparm but it doesn't actually work. I tried to use CustInvoiceTable as well but doesn't seem to work. When I was creating purchase orders i had to use VendInvoiceInfoTable in order to set these parameters because purchParmTable wouldn't work for that either.
Does anyone know how to invoice and set document date for sales orders? thanks

static void ColtsSalesOrder(Args _args)
{
    //declaring variables
    InventDimId _inventDimId;
    SalesTable salesTable;

    SalesLine salesLine;

    NumberSeq numberSeq;

    SalesFormLetter salesFormLetter;
    SalesParmTable salesParmTable;

    recId                               dimensionId;
    DimensionAttributeValueSetStorage   storage;
    DimensionAttribute                  dimensionAttribute;
    DimensionAttributeValue             dimensionAttributeValue;

    SalesParmUpdate salesParmUpdate;
    SalesFormletterParmData     salesFormLetterParmData;

    CustInvoiceTable custInvoiceTable;
    CustInvoiceTrans custInvoiceTrans;
   // CustInvoiceLine custINvoiceLine;
    VendInvoiceInfoTable vendInvoiceInfoTable;
    CustInvoiceJour custInvoiceJourNew;
    AxSalesTable axsalesTable;
    
    SalesInvoiceJournalCreateBase SalesInvoiceJournalCreateBase;


    Date myDate;
    str test;
    container  ledgerDimensions;
    DimensionDefault dimensionDefault;
    str InvoiceNum;

    changeCompany("MYCOMPANY") //Inserts into specified company
    {
        ttsBegin;

        //creating sales order header

        //getting sales order id from number sequence

        _inventDimId="someID";
              test="12/15/2018";
            myDate=str2Date(test,213);

        /*  inventDim.InventSiteId = "1";
         inventDim = InventDim::findOrCreate(inventDim);

         salesLine.InventDimId = inventDim.inventDimId;
        */

        numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
        numberSeq.used();

        //salesTable.initFromSalesTable(salesTable);

        salesTable.initValue();
        salesTable.SalesId = numberSeq.num();
        salesTable.CustAccount = "SOMEACCOUNT";
        // salesTable.initFromSalesTable(salesTable);
        salesTable.initFromCustTable();

        // salesTable.ShippingDateRequested=myDate;
        // salesTable.InvoiceAccount="adsf";
        // salesTable.CurrencyCode="CAD";
        // salesTable.LanguageId="EN";
        //salesTable.CustGroup="adsf";

        //validate

        if (!salesTable.validateWrite())
        {
            throw Exception::Error;
        }

        salesTable.insert();

        //creating sales order line
        salesLine.clear();
        salesLine.SalesId = salesTable.SalesId;

        //salesLine.initValue(salesTable.SalesType);
        //salesLine.initFromSalesTable(salesTable);
        //salesLine.initFromInventTable(InventTable::find('SOMEID'));
        //salesLine.setInventDimId(_inventDimId);
        //salesLine.InventDimId="SOMEID";
        //salesLine.ShippingDateRequested=myDate;
        //salesLine.CurrencyCode="CAD";
        //salesLine.LanguageId="EN";
        //salesLine.CustGroup="adsf";
        //salesLine.CustomerCode="asdf";


        salesLine.ItemId = "SOMEID";

        salesLine.SalesQty = 1;
        salesLine.SalesPrice=1;

        //salesLine.initFromItemOrCategory(salesLine.ItemId, salesLine.SalesCategory, "");

        salesLine.LineAmount=5;

        storage = new DimensionAttributeValueSetStorage();

        dimensionAttribute = AxdDimensionUtil::validateFinancialDimension("ItemGroup");
        dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, "SUMP");

        // Add attribute
        storage.addItem(dimensionAttributeValue);
        dimensionId = storage.save();
        salesLine.DefaultDimension=dimensionId;

        salesLine.createLine(true, // Validate
                            true, // initFromSalesTable
                            false, // initFromInventTable
                            true, // calcInventQty
                            true, // searchMarkup
                            false  // searchPrice);

        ttsCommit;

        //confirm sales order

        InvoiceNum=SalesTable.SalesID;

        salesFormLetterParmData = SalesFormletterParmData::newData(
                                                                DocumentStatus::Invoice,
                                                                VersioningUpdateType::Initial);

        salesFormLetterParmData.parmOnlyCreateParmUpdate(true);
        salesFormLetterParmData.createData(false);
        salesParmUpdate =  salesFormLetterParmData.parmParmUpdate();

        
        salesParmTable.clear();
        salesParmTable.initValue();
        salesParmTable.TransDate                = SystemDateGet();
        salesParmTable.DocumentDate = myDate;
        salesParmTable.Ordering                 = DocumentStatus::Invoice;
        salesParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
        salesParmTable.SalesID                  = salesTable.SalesID;
        salesParmTable.SalesName                = salesTable.SalesName;
        salesParmTable.DeliveryName             = salesTable.DeliveryName;
        salesParmTable.DeliveryPostalAddress    = salesTable.DeliveryPostalAddress;
        salesParmTable.CustAccount             = salesTable.CustAccount;
        salesParmTable.CurrencyCode             = salesTable.CurrencyCode;
        salesParmTable.InvoiceAccount           = salesTable.InvoiceAccount;
        salesParmTable.ParmId                   = salesParmUpdate.ParmId;
        
        // if (salesParmTable.validateWrite())
        salesParmTable.insert();
        //else
        //  throw Exception::Error;

        custInvoiceTable.initValue();
        custInvoiceTable.SalesId=salesTable.SalesID;
        custInvoiceTable.DocumentDate=myDate;
        custInvoiceTable.InvoiceDate=myDate;
        custInvoiceTable.OrderAccount="003-000009";
        custInvoiceTable.insert();


        // Set PurchParmLine table
        while select salesLine
            where salesLine.SalesId == salesTable.SalesId
        {
            custInvoiceTrans.clear();
            custInvoiceTrans.initFromSalesLine(salesLine);
            //custInvoiceTrans.InventNow = 1;
            custInvoiceTrans.LineAmount = salesLine.LineAmount;
            //custInvoiceTrans.ship
            //custInvoiceTrans.ReceiveNow = salesLine.PurchQty;

            custInvoiceTrans.RemainBefore = 1;
            //custInvoiceTrans.RemainBeforeInvent = 1;
            //custInvoiceTrans.TableRefId = custInvoiceTable.TableRefId;
            custInvoiceTrans.insert();
        }

        salesFormLetter = salesFormLetter::construct(DocumentStatus::Confirmation);
        salesFormLetter.update(salesTable, // Purchase record Buffer
        systemdateget()); // Transaction date

        salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
        salesFormLetter.salesTable(salesTable);
        salesFormLetter.initParmDefault();
        salesFormLetter.transDate(systemDateGet());
        salesFormLetter.proforma(false);
        salesFormLetter.printFormLetter(false);     
        salesFormLetter.specQty(SalesUpdate::All);
        salesFormLetter.parmId(salesParmTable.ParmId);
        salesFormLetter.salesParmUpdate(salesFormLetterParmData.parmParmUpdate());

        salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(), Printout::Current); 
        //  salesFormLetter.initLinesQuery();
        salesFormLetter.update(salesTable, systemdateget());



        //  salesFormLetter.run();
        //   custInvoiceJourNew = salesFormLetter.getOutputContract().parmJournal();
        // 

        //displaying sales order id
        info(salesTable.SalesId);
    }
}

Visual Studio 2017

$
0
0

Does anyone know when the development environment for D365FO will change to Visual Studio 2017?

I am successful about Full build, and Sync DB, but I failed at rebuild.

$
0
0

Hi

    I in my local VM, I have a project. I did full build and Sync DB, and successful. However, I failed at rebuild. What may cause this problem?

Error when calling Odata Action from Postman

$
0
0

Hi,

I get below error when calling my Odata action from postman.

Please help out!!

below method is in my entity "xxx_CustomerEntity"

[SysODataActionAttribute("UpdateComplete", true)]
public void UpdateComplete(AccountNum _accountNum, NoYesId _isComplete)
{
xxx_CustomerEntity customerEntity;

ttsbegin;
select forupdate customerEntity
where customerEntity.AccountNum == _accountNum;

customerEntity.IsImported = _isComplete;
customerEntity.update();
ttscommit;
}

    "Message": "No HTTP resource was found that matches the request URI 'https://[baseurl]/data/Microsoft.Dynamics.DataEntities.UpdateComplete'. No route data was found for this request."

Regards,

Pradeep

Code Upgrade : Build Failed with Error (Azure DevOps) Exit Code :100

$
0
0

Hi Friends ,

I'm facing issue with Build Stage at Code Upgrade on Azure DevOps (VSTS) as follows it's seems to Auth Error , but to fix that where do i need to change or Modify ?

Thanks & Regards,

Amith Prasanna

How to Create WSDL Service in D365 in Visual Studio

$
0
0

Hi,

I want to create wsdl service in d365 , that service passed parameters and get the result by json format,

if anybody know the algorithm kindly do needful

I tried to open WSDL inbound port in the browser but I found that it return few tables not all the tables in the query

$
0
0

Please help me as long as someone got stuck with it . I tested this WSDL through SoapUI.

Exception error when right clicking an object

$
0
0

Hi,

I am encountering an issue every-time I am right-clicking on any object.

I am using a Virtual machine.
I tried looking on internet but could not find any solution.
  

Please tell me why is there this issue and how could it be resolved.


how to handle null value string column of a View in X++ ?

$
0
0

i have created a View InventTransWithBranchDept with following records for the Item "TV":

now here is my code, the while loop on asIsTable is just not picking the row with null or empty Department

LF_InventTransWithBranchDeptDimView grpTable;
LF_InventTransWithBranchDeptDimView asIsTable;

while select grpTable
group by grpTable.Branch , grpTable.Department, grpTable.ItemId
where grpTable.ItemId == "TV" //"10059"
{
     while select asIsTable
       where asIsTable.Branch == grpTable.Branch
         &&  asIsTable.Department == grpTable.Department
         && asIsTable.ItemId == grpTable.ItemId
              {
                  info( strFmt( "%1 - %2", asIsTable.Qty , asIsTable.Department) );
               }
}

i have tried this too but no luck  -  

(    ( asIsTable.Department == "" && grpTable.Department == "")

     ||  &&  asIsTable.Department == grpTable.Department  )

 

any help here would be appreciated

- San

Error when exporting large number of records to CSV

$
0
0

Hi all,

I have a Query based SSRS report. Just a simple query with no complex stuff in it but gets huge data and the report runs fine. When the data is exported to CSV, after a while I get the below error. Please suggest how to fix this and export the data smoothly.

The maximum message size quota for incoming messages (2147483647) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

 

Thank you,

Praveen.

MetadataProvider with ModificationInfo Issue

$
0
0

Trying to find objects that are modified in a particular module using the code below:

        var environment = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
        str packageDir = environment.get_Aos().get_PackageDirectory();
        var runtimeProviderConfiguration = New Microsoft.Dynamics.AX.Metadata.Storage.Runtime.RuntimeProviderConfiguration(packageDir);
        var metadataProviderFactory = New Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory();
        Microsoft.Dynamics.AX.Metadata.Providers.IMetadataProvider provider = metadataProviderFactory.CreateRuntimeProvider(runtimeProviderConfiguration);

        //Error occurs on this line
        var tableModifications = provider.Tables.ListObjectsWithModificationInfo('NameOfModule');

This call 'should' return a list of objects modified along with the date that the object was modified, instead the following error is thrown for all modules:

Which is a little confusing because if this data isn't available at runtime then why have the method available?

Am I using this call correctly?

1 field with 2 number sequence

$
0
0

Hi,

I created a new number sequence and I need to use it with creating a new sales order only when a special condition achieved.

What are the method(s) I should extend to accomplish  this customization?

You help is most appreciated.

Thanks in advance.

Posting a Sales Order with parameters

$
0
0

I'm trying to create a sales order in x++ 2012 r2 and invoice. I can get it to invoice fine, but i want to be able to set the Document Date: which sales its set in SalesParmTable.
I can set the parameters below for salesparm but it doesn't actually work. I tried to use CustInvoiceTable as well but doesn't seem to work. When I was creating purchase orders i had to use VendInvoiceInfoTable in order to set these parameters because purchParmTable wouldn't work for that either.
Does anyone know how to invoice and set document date for sales orders? thanks

static void ColtsSalesOrder(Args _args)
{
    //declaring variables
    InventDimId _inventDimId;
    SalesTable salesTable;

    SalesLine salesLine;

    NumberSeq numberSeq;

    SalesFormLetter salesFormLetter;
    SalesParmTable salesParmTable;

    recId                               dimensionId;
    DimensionAttributeValueSetStorage   storage;
    DimensionAttribute                  dimensionAttribute;
    DimensionAttributeValue             dimensionAttributeValue;

    SalesParmUpdate salesParmUpdate;
    SalesFormletterParmData     salesFormLetterParmData;

    CustInvoiceTable custInvoiceTable;
    CustInvoiceTrans custInvoiceTrans;
   // CustInvoiceLine custINvoiceLine;
    VendInvoiceInfoTable vendInvoiceInfoTable;
    CustInvoiceJour custInvoiceJourNew;
    AxSalesTable axsalesTable;
    
    SalesInvoiceJournalCreateBase SalesInvoiceJournalCreateBase;


    Date myDate;
    str test;
    container  ledgerDimensions;
    DimensionDefault dimensionDefault;
    str InvoiceNum;

    changeCompany("MYCOMPANY") //Inserts into specified company
    {
        ttsBegin;

        //creating sales order header

        //getting sales order id from number sequence

        _inventDimId="someID";
              test="12/15/2018";
            myDate=str2Date(test,213);

        /*  inventDim.InventSiteId = "1";
         inventDim = InventDim::findOrCreate(inventDim);

         salesLine.InventDimId = inventDim.inventDimId;
        */

        numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
        numberSeq.used();

        //salesTable.initFromSalesTable(salesTable);

        salesTable.initValue();
        salesTable.SalesId = numberSeq.num();
        salesTable.CustAccount = "SOMEACCOUNT";
        // salesTable.initFromSalesTable(salesTable);
        salesTable.initFromCustTable();

        // salesTable.ShippingDateRequested=myDate;
        // salesTable.InvoiceAccount="adsf";
        // salesTable.CurrencyCode="CAD";
        // salesTable.LanguageId="EN";
        //salesTable.CustGroup="adsf";

        //validate

        if (!salesTable.validateWrite())
        {
            throw Exception::Error;
        }

        salesTable.insert();

        //creating sales order line
        salesLine.clear();
        salesLine.SalesId = salesTable.SalesId;

        //salesLine.initValue(salesTable.SalesType);
        //salesLine.initFromSalesTable(salesTable);
        //salesLine.initFromInventTable(InventTable::find('SOMEID'));
        //salesLine.setInventDimId(_inventDimId);
        //salesLine.InventDimId="SOMEID";
        //salesLine.ShippingDateRequested=myDate;
        //salesLine.CurrencyCode="CAD";
        //salesLine.LanguageId="EN";
        //salesLine.CustGroup="adsf";
        //salesLine.CustomerCode="asdf";


        salesLine.ItemId = "SOMEID";

        salesLine.SalesQty = 1;
        salesLine.SalesPrice=1;

        //salesLine.initFromItemOrCategory(salesLine.ItemId, salesLine.SalesCategory, "");

        salesLine.LineAmount=5;

        storage = new DimensionAttributeValueSetStorage();

        dimensionAttribute = AxdDimensionUtil::validateFinancialDimension("ItemGroup");
        dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, "SUMP");

        // Add attribute
        storage.addItem(dimensionAttributeValue);
        dimensionId = storage.save();
        salesLine.DefaultDimension=dimensionId;

        salesLine.createLine(true, // Validate
                            true, // initFromSalesTable
                            false, // initFromInventTable
                            true, // calcInventQty
                            true, // searchMarkup
                            false  // searchPrice);

        ttsCommit;

        //confirm sales order

        InvoiceNum=SalesTable.SalesID;

        salesFormLetterParmData = SalesFormletterParmData::newData(
                                                                DocumentStatus::Invoice,
                                                                VersioningUpdateType::Initial);

        salesFormLetterParmData.parmOnlyCreateParmUpdate(true);
        salesFormLetterParmData.createData(false);
        salesParmUpdate =  salesFormLetterParmData.parmParmUpdate();

        
        salesParmTable.clear();
        salesParmTable.initValue();
        salesParmTable.TransDate                = SystemDateGet();
        salesParmTable.DocumentDate = myDate;
        salesParmTable.Ordering                 = DocumentStatus::Invoice;
        salesParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
        salesParmTable.SalesID                  = salesTable.SalesID;
        salesParmTable.SalesName                = salesTable.SalesName;
        salesParmTable.DeliveryName             = salesTable.DeliveryName;
        salesParmTable.DeliveryPostalAddress    = salesTable.DeliveryPostalAddress;
        salesParmTable.CustAccount             = salesTable.CustAccount;
        salesParmTable.CurrencyCode             = salesTable.CurrencyCode;
        salesParmTable.InvoiceAccount           = salesTable.InvoiceAccount;
        salesParmTable.ParmId                   = salesParmUpdate.ParmId;
        
        // if (salesParmTable.validateWrite())
        salesParmTable.insert();
        //else
        //  throw Exception::Error;

        custInvoiceTable.initValue();
        custInvoiceTable.SalesId=salesTable.SalesID;
        custInvoiceTable.DocumentDate=myDate;
        custInvoiceTable.InvoiceDate=myDate;
        custInvoiceTable.OrderAccount="003-000009";
        custInvoiceTable.insert();


        // Set PurchParmLine table
        while select salesLine
            where salesLine.SalesId == salesTable.SalesId
        {
            custInvoiceTrans.clear();
            custInvoiceTrans.initFromSalesLine(salesLine);
            //custInvoiceTrans.InventNow = 1;
            custInvoiceTrans.LineAmount = salesLine.LineAmount;
            //custInvoiceTrans.ship
            //custInvoiceTrans.ReceiveNow = salesLine.PurchQty;

            custInvoiceTrans.RemainBefore = 1;
            //custInvoiceTrans.RemainBeforeInvent = 1;
            //custInvoiceTrans.TableRefId = custInvoiceTable.TableRefId;
            custInvoiceTrans.insert();
        }

        salesFormLetter = salesFormLetter::construct(DocumentStatus::Confirmation);
        salesFormLetter.update(salesTable, // Purchase record Buffer
        systemdateget()); // Transaction date

        salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
        salesFormLetter.salesTable(salesTable);
        salesFormLetter.initParmDefault();
        salesFormLetter.transDate(systemDateGet());
        salesFormLetter.proforma(false);
        salesFormLetter.printFormLetter(false);     
        salesFormLetter.specQty(SalesUpdate::All);
        salesFormLetter.parmId(salesParmTable.ParmId);
        salesFormLetter.salesParmUpdate(salesFormLetterParmData.parmParmUpdate());

        salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(), Printout::Current); 
        //  salesFormLetter.initLinesQuery();
        salesFormLetter.update(salesTable, systemdateget());



        //  salesFormLetter.run();
        //   custInvoiceJourNew = salesFormLetter.getOutputContract().parmJournal();
        // 

        //displaying sales order id
        info(salesTable.SalesId);
    }
}

How To get data from sysdatabaselog and how to make list

$
0
0

Hi, im new in AX 2012

1. i wanna ask how to get data from sysdatabselog table. i dont know how is the best way to make relation between sysdatabase and another table. example i wanna make relation between sysdatabselog and prodtable.

2. how to make list like the right side from the picture below

thanks

Error when running the Workflow in Purchase Requisition

$
0
0

Hi,

I have an issue regarding to run the workflow in purchase requisition. I have already filled up the financial dimension in purchase requisition line details.

Here are the details of the error below.

CostCenter 012 is not an allowed value for the combination.

CostCenter 012 is not an allowed value in combination with the following dimensions values that are valid:

  • MainAccount 618900.
  • BusinessUnit <blank>.
  • Department <blank>.
  • The combination was not validated beyond the CostCenter financial dimension.
  • Dimension values were validated with this account structure: Manufacturing P&

Thank you for you reply.

BR,

CJ


Dynamic file name for the SalesINVOICE PDF

$
0
0

Hello,

When the sales invoice report is printed in the screen, we have a option to save the report as PDF.

It saves in the the name "Show tax invoice" as default. Is there an option to save this name as Dynamically.

I need the PDF name to be Invoice no: XXX when user saves the report as PDF.

Please let me know if this is possible.

I have tried with creating a new controller class, extending the salesinvoicecontroller and there in the main method, i put it as follows,

but it it still saving in the name , Show TaX Invoice.

SalesInvoiceController formLetterController = SalesInvoiceController::construct();
formLetterController.parmArgs(_args);
formLetterController.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat());
formLetterController.parmShowDialog(false);
formLetterController.parmDialogCaption("XX");// here i pass the invoice number
formLetterController.startOperation();

FirstOnly query property

$
0
0

Hi all

Running AX 2012 R3 CU9.

Have spent a long time with workarounds for this in various projects because I can't get the simple methods to work.

I have created a small simple query to show the problem I'm having. See below query TEE_FirstConfirmation linking SalesLine parent table with CustConfirmTrans child table :

As you can see I've selected "firstOnly" property (on both of these data sources, though I've also tried only header and only footer). But when I look at an order which has multiple CustConfirmTrans records, it's still splitting and giving me multiple CustConfirmTrans.

I need a way of selecting only the first CustConfirmTrans record - currently I use a view which fetches the first record in behaviour similar to a subquery, but that small complication magnifies into long wait times on reports with multiple similar joins.

I'm so sure there must be something simple I'm missing on such a common use case. Any help would be much appreciated

Thanks very much in advance

Luke

How to add new value in container with code?

$
0
0

Hi,

I have this form:

this is the form "projTable"

I want to add new field "sortingId4" 

but I don't find the code which can I add new field in sortingId?

Fetching Some Fields Data On Report

$
0
0

Hi,

I want to fetch E Way Bill Number, Document Date, Document No., Vehicle No. To Display On My Sales Invoice Report

Also InventBatchID. I am new in AX Development I Don't It How To Fetch That Data, Please Help....

Thanks

WinAPI methods replacement in D365

$
0
0

Hi All,

In AX 2012, I have the code which calls WinAPI method getSaveFileName. This method shows the Saveas dialog with the fileName suggested in the FileName field. Does anyone know if there is any replacement for this method in D365, as WinAPI has been deprecated. I already looked at the FileUpload.. classes in AOT, but couldn't find any method which does the same thing I am looking for.  The requirement is to get the fileName from the user through SaveAs dialog and then write to that file.

Thanks,

Baber.

Viewing all 17532 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>