Hi,
In this post we will see the code that helps us to know whether the required contact type of concerned role is present on a given customer or not. For demo purpose, chosen customer by name "TestCustomer" to display the contact info where type is Email, role is business and name is abc@gmail.com.
Note: CG_CheckContactTypeExists is a runnable class
class CG_CheckContactTypeExists{ /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { DirPartyLocation dirPartyLocation; LogisticsLocation location; LogisticsElectronicAddress address; LogisticsElectronicAddressRole addressLocationRole; LogisticsLocationRole locationRole; DirPartyTable dirPartyTable; CustTable custTable; select AccountNum from custTable where custTable.AccountNum == "10049" join RecId from dirPartyTable where dirPartyTable.RecId == custTable.Party; select Location, RecId from dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId join RecId from location where location.RecId == dirPartyLocation.Location join address where ((address.Type == LogisticsElectronicAddressMethodType::Email) && (address.Location == location.RecId)) exists join RecId from addressLocationRole where (addressLocationRole.ElectronicAddress == address.RecId) exists join RecId from locationRole where ((addressLocationRole.LocationRole == locationRole.RecId) && (locationRole.IsContactInfo == NoYes::Yes) && (locationRole.Name == "Business")); if (dirPartyLocation.RecId) { Info(strFmt("Contact of type Email with %1 exists for customer %2", address.Locator, custTable.AccountNum)); } } }Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments