Wednesday, February 26, 2014

HTTP request through X++

X++ code to make HTTP request

xml                         response = "";
    System.Net.HttpWebRequest   httpRequest  = null;
    System.Net.HttpWebResponse  httpResponse = null;
    CLRObject                   clro         = null;
    System.IO.Stream            stream       = null;
    System.IO.StreamReader      streamReader = null;
    System.Byte[]               bytes        = null;
    System.Text.Encoding        encoding     = null;

        new InteropPermission(InteropKind::ClrInterop).assert();
        clro         = System.Net.WebRequest::Create(url);
        httpRequest  = clro;
            encoding    = System.Text.Encoding::get_UTF8();
            bytes       = encoding.GetBytes(body);
            stream      = httpRequest.GetRequestStream();
            stream.Close ();

        httpResponse = httpRequest.GetResponse();
        stream = httpResponse.GetResponseStream();
        streamReader = new System.IO.StreamReader(stream);
        response = streamReader.ReadToEnd();
        throw error(AifUtil::getClrErrorMessage());
    return response;

Tuesday, February 25, 2014

Update or Create Party Addresses

Following code helps you to create or update party (Customer/Vendor/Employees) addresses using standard function

select firstOnly postalAddressView
                    join Location,LocationRole from locationRolesView
                   where locationRolesView.Location     == postalAddressView.Location
                      && locationRolesView.LocationRole == LogisticsLocationRole.RecId
                      && postalAddressView.Party        == partyId;

        postalAddressView.Street           = street1;
            postalAddressView.Street           += " " + street2;
        postalAddressView.City             = city;
        postalAddressView.State            = stateId;
        postalAddressView.CountryRegionId  = countryCode;
        postalAddressView.ZipCode          = zipCode;
        postalAddressView.Address          = LogisticsPostalAddress::formatAddress(postalAddressView.Street,  postalAddressView.ZipCode, postalAddressView.City, postalAddressView.CountryRegionId, postalAddressView.State,'');
        postalAddressView.IsPrivate        = NoYes::No;

        postalAddressViewResult = dirParty.createOrUpdatePostalAddress(postalAddressView,[LogisticsLocationRole.recid]);

Thursday, January 16, 2014

An Introduction

          Dear Friends... I am going to share with you my experience in leading Dynamics AX teams. As a Team lead, I face technical and people challenges every day. So I feel sharing my experience with you will help our AX community build teams operating with less stress and increased productivity.

          I will write about my journey towards becoming a team lead where I now have responsibilities in maintaining a high performing and quality AX application, instituting code review practices, build and promoting fixes to different environments, conducting periodic audits of application and servers, managing developer objectives and things I follow up with my team daily.

         More to come. I am looking forward to engaging with you on this topic of becoming an AX team leader.