Monday, 19 March 2018

Get Email for Customer / Vendor (with specific roles)

To get an email address for a customer or vendor, you can use the following statement


static void Cust_emailStmtjob(Args _args)
{
    CustTable                                        cust; //Replace with vendTable for Vendors
    DirPartyLocation                                        dirPartyLocation;
    LogisticsElectronicAddress            elecAddress;
    LogisticsElectronicAddressRole    elecAddressRole;
    LogisticsLocationRole                    locRole;
   
    select firstOnly cust
        where cust.AccountNum == '‪‪‪us-001';
    while select DirPartyLocation
        where dirPartyLocation.party == cust.Party
    {
        while select elecAddress
            where elecAddress.Location == dirPartyLocation.Location
                   && elecAddress.Type == LogisticsElectronicAddressMethodType::Email
        {
            while select elecAddressRole
                where elecAddressRole.ElectronicAddress == elecAddress.RecId
                    join locRole
                        where locRole.RecId == elecAddressRole.LocationRole
                            && locRole.Name == "Invoice"
            {
                info(strFmt("%1 - %2", elecAddress.Locator, locRole.Name));
            }
        }
    }

}

Add field on Purchase order confirmation report



Add field on Purchase order confirmation report

There is requirement to add field on PO lines and same for the confirmation report. It’s not the straight away to add field on the report. It requires to add field on other objects (table/view/query).

On PurchPurchaseOrderreport it uses the PurchLineALLVersionsview to get the details of the PO on the PurchPurchaseOrderDP. So follow the below steps to add field on PurchLineAllVersions view.



  1. Add field on the PurchLine Table
  2.  Add field on the PurchLineHistory Table
  3. Now, Refresh or Restore the queries used for PurchLineArchivedVersions and PurchLineNotArchivedVersions as this have dynamics field property to “Yes” our new fields should be added automatically on this queries and Verify the field is added on the query.
  4. Now, Restore the views PurchLineArchivedVersions and  PurchLineNotArchivedVersions( if you want add field on the views)
  5. Add field on PurchLineAllVersion, here you have to add field manually as the dynamics field property is set.
  6. That’s it, now use the field on the PurchPurchaseOrderDP to have on report. You also have to add field on tmp table.