April 20, 2013

X++ code for document attachment

X++ code for document attachment





In Axapta, we can attach document with Purchase order via document handling, if you need to attached a document using your x++ code, we need to use following x++ AOT objects.
  • DocuRef (table)
  • DocuActionArchive (class)
Here is a generic method that will attach record to any table in AX based on parameters passed to it

void attachDoc(RefTableId _refTableId, RefRecId _refRecId, selectableDataArea _refCompanyId, FileName _name)
{
    DocuRef docuRef;

    DocuActionArchive archive;
    ;
    docuRef.clear();
    docuRef.RefRecId = _refRecId;
    docuRef.RefTableId = _refTableId;
    docuRef.RefCompanyId = _refCompanyId;
    docuRef.Name = _name;
    docuRef.TypeId = 'File';
    docuRef.insert();
    archive = new DocuActionArchive();
    archive.add(docuRef, _name);
}

To use this method write following code to attache the document.

this.attachDoc(tableNum(PurchTable), purchTable.RecId, purchTable.dataAreaId, filepathname);

-Harry

April 19, 2013

Creating Vendors through X++ in AX 2012- PART I

Creating Vendors through X++ in AX 2012- PART I

--Create party for the vendor--

public void TheAxaptaCreateParty(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);
    }
}


-Harry

April 18, 2013

Standalone Installers Of .NET Framework

Standalone Installers Of .NET Framework 4.5, 4.0, 3.5, 3.0 & 2.0 From Microsoft Download Center


Updated: May 6, 2017.

Hi All,
Here i am sharing some links to download all .net fromaworks (standalone installations) from microsoft download center.

.NET Framework 4.7
.NET Framework 4.6.2
.NET Framework 4.6.1
.NET Framework 4.5.2

.NET Framework 4.5 Setup
.NET Framework 4.0 Setup
.NET Framework 3.5 Setup
.NET Framework 3.5 Setup Service Pack 1
.NET Framework 3.0 Setup
.NET Framework 2.0 Setup
.NET Framework Client Profile Offline Installer
-Harry

Multi Tab Lookups in AX

Multi Tab Lookups in Dynamics AX

Its a tricky post, just go through it and try to develop yours.
For example you  have a requirement in which you want to show multiple tabs on a lookup form. You have a field in which you want your user to either select a customer or vendor from a lookup then this could be the best option to show multiple tabs and let user select either customer or vendor.

Following are the steps to get this done.

* Create a new form "TheaxaptaLookupForm" with multiple tabs on it ( same as other forms)
* Create a new EDT and The FormHelp property of the EDT should be set to the form you just created "
TheaxaptaLookupForm".


For reference you can chcek this form.
AOT\Forms\DimensionsLookup


-Harry