Friday, 12 June 2015

Useful Codes

Index : 

1. To get new and old values in modified method of any table
2.
To get new and old values in Modified method of any table :

public void modifiedField(FieldId _fieldId)
{
if (fieldNum(SalesTable, ShippingDateRequested) == _fieldId)
    {
        str oldValue, newvalue;
        oldValue = this.orig().(_fieldId);
       newvalue = this.(_fieldId);
     info(strfmt("Field number %1 changed from %2 to %3",_fieldId,this.orig().(_fieldId),this.            (_fieldId)));
}

Thursday, 11 June 2015

Re- Use Jobs for Reference

Get all Customer Postal Address

static void CustPostalAdresses(Args _args)
{
    CustTable custtbl;
    LogisticsPostalAddress  postalAddress;
    DirPartyLocation partyLocation;
    custtbl =   CustTable::find("US-001",false);
   while  select  postalAddress
    exists join partyLocation
        where partyLocation.Location == postalAddress.Location
        //&& partyLocation.IsPrimary == true
        && partyLocation.Party == custtbl.party
    {

    info(strFmt("%1",postalAddress.RecId,postalAddress));
    }
}