Selasa, 02 Juli 2019

Cara mengetahui regionId

coba dan tambahkan code berikut diJob baru kalian.

static void PSMcobacountryregionID(Args _args)
{
    LogisticsAddressCountryRegionISOCode isoCountryCode = SysCountryRegionCode::countryInfo();
    
    LogisticsAddressCountryRegionId countryRegionId = SysCountryRegionCode::getCountryRegionIdByIsoCode(isoCountryCode);
    
    ;
    
    info(isoCountryCode);
    info(countryRegionId);
}

ini biasanya bisa dipakai untuk mengidentifikasi/custom Report Purchase Order/Sales Order 

Mencetak price pada report Purchase Order

https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/258358/how-do-you-print-a-purchase-order

Custom Purchase Order Report AX2012

Class pembentuk untuk report Purchase Order :
PurchasePurchaseOrderController class. 
PurchPurchaseOrderContract class.
PurchPurchaseOrderDP class.

Table temporary untuk datanya :
PurchPurchaseOrderTmp 



Untuk merubah design atau menambah format design report purchase order tidak hanya dilakukan pada Code classnya saja tetapi harus melalui :
Menu 
Procurement and Sourching > Setup > Forms > Form Setup
di Form Setup, menu General klik tombol Print Management.



Buka node Purchase Order. pada panel sebelah kanan dropdown field report format.
Jika tidak ada design baru yang kamu buat. maka, temukan tabel PrintMgmtReportFormat method Populate

PrintMgmtReportFormat::populate

tambahkan code berikut :(yang italic dan bold, saya menambahkan design Report4)

//
    switch (isoCountryCode)
    {
        case #isoCZ, #isoHU:
            addAX(PrintMgmtDocumentType::PurchaseOrderRequisition, countryRegionId);
            break;

        default:
    //
        addAX(PrintMgmtDocumentType::PurchaseOrderRequisition);
    //
       //husna
       addOther(PrintMgmtDocumentType::PurchaseOrderRequisition, ssrsReportStr(PurchPurchaseOrder, Report4), ssrsReportStr(PurchPurchaseOrder, Report4),countryRegionId);
            //husna
    }


Referensi :
https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/137972/customize-the-purchase-order-report

https://cloudblogs.microsoft.com/dynamics365/no-audience/2012/05/24/dynamics-ax-2012-reporting-how-to-specify-new-design-for-sales-order-confirmation/



Jumat, 28 Juni 2019

Membuat proses yang bekerja menggunakan batch job


Proses ini akan bekerja berdasarkan batch job. 
Contoh :
Kita akan membuat suatu proses update pada sebuah table. ex ItemHusna, table master untuk data Item yang datasourcenya dari InventTable

buatlah class. contoh HYNmahasiswa.
class HYNmahasiswa
{
    InventTable         itemTable;
}

buat method : processRecords

[SysEntryPointAttribute(false)]
public void processRecords()
{
    int             counter = 0;
    InventTable       tableInvent;


    //Determines the runtime
    if (xSession::isCLRSession())
    {
        info('Running in a CLR session.');
    }
    else
    {
        info('Running in an interpreter session.');

        //Determines the tier
        if (isRunningOnServer())
        {
            info('Running on the AOS.');
        }
        else
        {
            info('Running on the Client.');
        }
    }
     
//panggil method yang akan mengupdate table ItemHusna

While select tableInvent
{
      this.getDataitem(tableInvent.ItemId);
}

    info(strFmt("Successfully processed %1 records.", counter));
}

//buat mehtod getDataitem([parameter dengan extended data type ItemId]
public void getLeadtime(ItemId  _itemId)
{
    ItemHusna               dataitemhusna;
;

select forupdate dataitemhusna;
ttsbegin;
     dataitemhusna.itemid = _itemid.itemid;
     dataitemhusna.insert();
ttscommit;
}

Buat menuitem Output dengan propertis sebegai berikut.

Label            : [nama label akan muncul di batch queue]
Object type  : Class
Object          : SysOperationServiceController
Parameters   : HYNmahasiswa.getLeadtime

FULL CILL Aplikasi AX.

Pada menu Item action HYNmahasiswa > klik kanan > Open.

maka terbuka form dialog untuk menjalankan batch job. pilih group batch jobnya, atur recurencenya klik OK.

Selasa, 14 Mei 2019

About UTCDATETIME

Saat kita membuat suatu parameter query berdasarkan date tetapi yang akan dijadikan sql statement itu mempunyai tipe data UtcDateTime.
yang meminta proggrammer bukannya value date tetapi juga value time.

Bisa kita pakai logic pendefinsian seperti ini :

date             fromdate;
date             todate;
TimeOfDay               starttime;
TimeOfDay               endtime;
utcDateTime         fromutc;
utcDateTime         toutc;

;

fromdate = 08\01\2019;
todate = 09\01\2019;
starttime = str2time("00:00:00");
endtime = str2time("00:00:00");

fromutc = DateTimeUtil::newDateTime(fromdate,starttime);
toutc = DateTimeUtil::newDateTime(todate,endtime);

kita lihat disini UTCDATETIME bisa dibentuk dari dua buah variable, Date dan juga Timeofday.

Senin, 13 Mei 2019

Membuat Credit Note di PO

Ada kalanya kita salah input untuk Product Receipt, hingga berimbas ke Invoice PO.
Di Ax sebelumya kita bisa memperbaiki hal tsb dengan entri baru Product receipt dengan nilai qty minus. Sedangkan di AX2012 fitur tersebut sudah dihilangkan.

Gantinya AX2012 menggunakan Credit Note.
Berikut cara2nya.



  1. Pilih no PO yang bermaslah dengan product receipt dan invoice tsb.
  2. Create PO baru dengan vendor dari PO bermasalah tersebut.
  3. setelah terbuat pilih menu/tombol 'Credit note' 
  4. pilih Invoice yang muncul berdasarkan Vendor yang dipakai
  5. mark invoicenya dan juga line yang ingin didelete.
  6. klik OK
  7. maka PO tersebut mempunyai nilai Qty minus.
selamat mencoba.

Kamis, 02 Mei 2019

The SQL Server Reporting Services Server name does not exist or the Web Service URL is not valid

"The SQL Server Reporting Services Server name does not exist or the Web Service URL is not valid"

Hari ini aku menemukan error pada saat validasi konfigrasi report server.
bisa disebabkan karena beberapa hal.
1. Pastikan Report Manager URL dan WEB service URL sama dengan alamat yang ada di Reporting Services Configuration manager.
jika masih belum "success"
2. coba buka firewall di report server. maka cek di Windows Firewall advance security.
https://community.dynamics.com/ax/b/fsilvajunior/archive/2016/10/28/dynamics-ax2012-relat-rios-erro-ao-validar-configura-es
3. Jika masih saja muncul coba mengubah alamat Report Manager URL dan WEB service URL yang tadinya oleh alamat IP menjadi alamat HostName:

http://setspn.blogspot.com/2013/07/ax-2012-validate-settings-fails-for.html

Cloud hosted environment di D365

Biasanya kita menginginkan sebuah environment yang sama dengan LIVE/PROD untuk mengtest sebuah proses. Maka kita bisa menggunakan fitur Clou...