class Service1 { public ResponseContract create(RequestContract _request) { System.Exception ex; int startLine = infologLine(); ResponseContract response = new ResponseContract(); if(_request) { try { if(this.validate(_request)) { DirPartyLocationPostalAddressV2Entity partyPostalAddressEntity; // logic partyPostalAddressEntity.insert(); } else { throw Exception::Error; } } //catch(Exception::Error) //{ // response.parmErrorMessage(this.getErrorMessage(startLine)); //} //catch(ex) //{ // response.parmErrorMessage(ex.Message); //} catch { resContract.parmErrorMessage(this.getErrorMessage(startLine)); } } return resContract; } }
class PostalAddress { /// <summary> public LogisticsPostalAddressRecId createAddress(PostalAddressContract _postalAddress, CustAccount _custAccount = '') { LogisticsPostalAddressRecId postalAddressRecId; try { CustTable custTable = CustTable::find(_custAccount); if(custTable) { DirPartyTable dirPartyTable = DirPartyTable::findRec(custTable.Party); if(_postalAddress) { DirPartyLocationPostalAddressV2Entity partyPostalAddressEntity; partyPostalAddressEntity.PartyNumber = dirPartyTable.PartyNumber; partyPostalAddressEntity.Street = _postalAddress.Street(); partyPostalAddressEntity.City = _postalAddress.City(); partyPostalAddressEntity.County = _postalAddress.County(); partyPostalAddressEntity.State = _postalAddress.State(); partyPostalAddressEntity.CountryRegionId = _postalAddress.CountryRegionId(); partyPostalAddressEntity.ZipCode = _postalAddress.PostCode(); partyPostalAddressEntity.Roles = LogisticsLocationRoleType::Delivery partyPostalAddressEntity.Description = _postalAddress.LocationName(); partyPostalAddressEntity.insert(); // it fails here LogisticsPostalAddress logisticsPostalAddress = LogisticsPostalAddress::findByLocation(partyPostalAddressEntity.RecId); postalAddressRecId = logisticsPostalAddress.RecId; } } } catch(Exception::Error) { throw error('Error when creating address'); } return postalAddressRecId; } }
//catch(Exception::Error) //{ // response.parmErrorMessage(this.getErrorMessage(startLine)); //} //catch(ex) //{ // response.parmErrorMessage(ex.Message); //} catch { response.parmErrorMessage(this.getErrorMessage(startLine)); }
class Service1 { public ResponseContract create(RequestContract _request) { System.Exception ex; int startLine = infologLine(); ResponseContract response = new ResponseContract(); if(_request) { try { if(this.validate(_request)) { // logic } else { throw Exception::Error; } } catch { resContract.parmErrorMessage(this.getErrorMessage(startLine)); } } return resContract; } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,351
André Arnaud de Cal... 874 Super User 2025 Season 2
Sohaib Cheema 638 User Group Leader