• tim-at-hastings
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

I'm having a tuff time deciding the best way to deal with accounts that have more then one location/store. Our business rules force the requirement that the system must be able to link a contact to a location for a given account but at the same time the system needs to give the user all contact at all locations for a given account. Now I know there are many ways to meet these requirements. The question is what is the best data design option in Salesforce.

 

Option 1: Create an account record for the main headquarters of an account then add an account record for each location/store and set the parent account field to the first account that was created.

 

Option 2: Build a Location custom object to deal with it and add relationships between Accounts, Locations, and Contacts.

 

Option 3: ? I don't know. Are there any other options?

 

To make this a lot more fun we use PRM, Customer Portal, and Person Accounts (with two other record types for the account object). There has to be other Salesforce customers with this same use case. Has any one out there seen a good solution to this?

Hi,

 

I want to render a page as PDF but the table has too many columns and looks messy in a potrait style layout.

 

How can I change it to landscape layout?

 

 

thanks,

Pooja

Hi,

I am having problem when accessing strikeiron webservice. Please help me.

I am accessing strikeiron webservice and trying to show the output in a scontrol but I am getting an error saying

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://www.strikeiron.com=ServiceStatus

Code:
// Here is the scontrol code //

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/12.0/connection.js"></script>
    <script src="/soap/ajax/12.0/apex.js"></script>
</head>

<body>
<div class="pagelabel"> Call webservice</div>
  <script language="javascript" type="text/javascript"> 
  function callStrikeIron()
  {
   //alert("Call Strike");
   var elem = document.getElementById("docBody");
   sforce.apex.debug=true;
   var theBody = '<table><tr><td>ZipInfo</td><td>';
   var result = sforce.apex.execute("StrikeIronWrapper", "wrapper", {varZipCode:"19406"});
   theBody += result + '</td></tr></table>';
   elem.innerHTML = theBody;
  }
  
  callStrikeIron();
  </script>
<div id="docBody"></div>
</body>
</html>

// Here is the actual class

//Generated by wsdl2apex

global class zipInfoLookup{
    public class ZipInfoListing {
        public String CityName;
        public String PreferredName;
        public String StateAbbreviation;
        public String Classification;
        public String County;
        private String[] CityName_type_info = new String[]{'CityName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] PreferredName_type_info = new String[]{'PreferredName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] StateAbbreviation_type_info = new String[]{'StateAbbreviation','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Classification_type_info = new String[]{'Classification','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] County_type_info = new String[]{'County','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'CityName','PreferredName','StateAbbreviation','Classification','County'};
    }
    public class ServiceOutput {
        public zipInfoLookup.SIWsStatus ServiceStatus;
        private String[] ServiceStatus_type_info = new String[]{'ServiceStatus','http://www.strikeiron.com','SIWsStatus','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceStatus'};
    }
    public class ZipInfoResult {
        public String Code;
        public String Latitude;
        public String Longitude;
        public String TimeZone;
        public String StandardGMTOffset;
        public String DaylightGMTOffset;
        public zipInfoLookup.ArrayOfZipInfoListing Listings;
        private String[] Code_type_info = new String[]{'Code','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Latitude_type_info = new String[]{'Latitude','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Longitude_type_info = new String[]{'Longitude','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] TimeZone_type_info = new String[]{'TimeZone','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] StandardGMTOffset_type_info = new String[]{'StandardGMTOffset','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] DaylightGMTOffset_type_info = new String[]{'DaylightGMTOffset','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Listings_type_info = new String[]{'Listings','http://www.strikeiron.com','ArrayOfZipInfoListing','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'Code','Latitude','Longitude','TimeZone','StandardGMTOffset','DaylightGMTOffset','Listings'};
    }
    public class ServiceInfoRecord {
        public String InfoKey;
        public String InfoValue;
        private String[] InfoKey_type_info = new String[]{'InfoKey','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] InfoValue_type_info = new String[]{'InfoValue','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'InfoKey','InfoValue'};
    }
    public class zipinfoSoap {
        public String endpoint_x = 'http://ws.strikeiron.com/StrikeIron/ZipInfo3/zipinfo';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public wsStrikeironCom.SubscriptionInfo SubscriptionInfo;
        public wsStrikeironCom.LicenseInfo LicenseInfo;
        private String SubscriptionInfo_hns = 'SubscriptionInfo=http://ws.strikeiron.com';
        private String LicenseInfo_hns = 'LicenseInfo=http://ws.strikeiron.com';
        private String[] ns_map_type_info = new String[]{'http://ws.strikeiron.com', 'wsStrikeironCom', 'http://www.strikeiron.com', 'zipInfoLookup'};
        public void GetRemainingHits() {
            wsStrikeironCom.GetRemainingHits_element request_x = new wsStrikeironCom.GetRemainingHits_element();
            wsStrikeironCom.GetRemainingHitsResponse_element response_x;
            Map<String, wsStrikeironCom.GetRemainingHitsResponse_element> response_map_x = new Map<String, wsStrikeironCom.GetRemainingHitsResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://ws.strikeiron.com/StrikeIron/ZipInfo3/zipinfo/GetRemainingHits',
              'http://ws.strikeiron.com',
              'GetRemainingHits',
              'http://ws.strikeiron.com',
              'GetRemainingHitsResponse',
              'wsStrikeironCom.GetRemainingHitsResponse_element'}
            );
            response_x = response_map_x.get('response_x');
        }
        public zipInfoLookup.StatusCodeOutput GetAllStatuses() {
            zipInfoLookup.GetAllStatuses_element request_x = new zipInfoLookup.GetAllStatuses_element();
            zipInfoLookup.GetAllStatusesResponse_element response_x;
            Map<String, zipInfoLookup.GetAllStatusesResponse_element> response_map_x = new Map<String, zipInfoLookup.GetAllStatusesResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.strikeiron.com/GetAllStatuses',
              'http://www.strikeiron.com',
              'GetAllStatuses',
              'http://www.strikeiron.com',
              'GetAllStatusesResponse',
              'zipInfoLookup.GetAllStatusesResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetAllStatusesResult;
        }
        public zipInfoLookup.ServiceInfoOutput GetServiceInfo() {
            zipInfoLookup.GetServiceInfo_element request_x = new zipInfoLookup.GetServiceInfo_element();
            zipInfoLookup.GetServiceInfoResponse_element response_x;
            Map<String, zipInfoLookup.GetServiceInfoResponse_element> response_map_x = new Map<String, zipInfoLookup.GetServiceInfoResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.strikeiron.com/GetServiceInfo',
              'http://www.strikeiron.com',
              'GetServiceInfo',
              'http://www.strikeiron.com',
              'GetServiceInfoResponse',
              'zipInfoLookup.GetServiceInfoResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetServiceInfoResult;
        }
        public zipInfoLookup.ZipInfoOutput GetCityState(String ZipCode) {
         // zipInfoLookup.ZipInfoOutput
            zipInfoLookup.GetCityState_element request_x = new zipInfoLookup.GetCityState_element();
            zipInfoLookup.GetCityStateResponse_element response_x;
            request_x.ZipCode = ZipCode;
            Map<String, zipInfoLookup.GetCityStateResponse_element> response_map_x = new Map<String, zipInfoLookup.GetCityStateResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.strikeiron.com/GetCityState',
              'http://www.strikeiron.com',
              'GetCityState',
              'http://www.strikeiron.com',
              'GetCityStateResponse',
              'zipInfoLookup.GetCityStateResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            system.debug('response ' + response_x);
            return response_x.GetCityStateResult;
        }
    }
    public class GetServiceInfo_element {
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{};
    }
    public class SIWsStatus {
        public Integer StatusNbr;
        public String StatusDescription;
        private String[] StatusNbr_type_info = new String[]{'StatusNbr','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] StatusDescription_type_info = new String[]{'StatusDescription','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'StatusNbr','StatusDescription'};
    }
    public class ArrayOfZipInfoListing {
        public zipInfoLookup.ZipInfoListing[] ZipInfoListing;
        private String[] ZipInfoListing_type_info = new String[]{'ZipInfoListing','http://www.strikeiron.com','ZipInfoListing','0','-1','true'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ZipInfoListing'};
    }
    public class StatusCodeOutput {
        public zipInfoLookup.StatusCodeResult ServiceResult;
        private String[] ServiceResult_type_info = new String[]{'ServiceResult','http://www.strikeiron.com','StatusCodeResult','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceResult'};
    }
    public class ArrayOfSIWsStatus {
        public zipInfoLookup.SIWsStatus[] SIWsStatus;
        private String[] SIWsStatus_type_info = new String[]{'SIWsStatus','http://www.strikeiron.com','SIWsStatus','0','-1','true'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'SIWsStatus'};
    }
    global class ZipInfoOutput {
        public zipInfoLookup.ZipInfoResult ServiceResult;
        private String[] ServiceResult_type_info = new String[]{'ServiceResult','http://www.strikeiron.com','ZipInfoResult','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceResult'};
    }
    public class SIWsResult {
        public Integer Count;
        private String[] Count_type_info = new String[]{'Count','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'Count'};
    }
    public class GetCityState_element {
        public String ZipCode;
        private String[] ZipCode_type_info = new String[]{'ZipCode','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ZipCode'};
    }
    public class StatusCodeResult {
        public zipInfoLookup.ArrayOfSIWsStatus Statuses;
        private String[] Statuses_type_info = new String[]{'Statuses','http://www.strikeiron.com','ArrayOfSIWsStatus','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'Statuses'};
    }
    public class SIServiceInfoResult {
        public zipInfoLookup.ArrayOfServiceInfoRecord ServiceInfo;
        private String[] ServiceInfo_type_info = new String[]{'ServiceInfo','http://www.strikeiron.com','ArrayOfServiceInfoRecord','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceInfo'};
    }
    public class ArrayOfServiceInfoRecord {
        public zipInfoLookup.ServiceInfoRecord[] ServiceInfoRecord;
        private String[] ServiceInfoRecord_type_info = new String[]{'ServiceInfoRecord','http://www.strikeiron.com','ServiceInfoRecord','0','-1','true'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceInfoRecord'};
    }
    public class GetAllStatuses_element {
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{};
    }
    public class GetServiceInfoResponse_element {
        public zipInfoLookup.ServiceInfoOutput GetServiceInfoResult;
        private String[] GetServiceInfoResult_type_info = new String[]{'GetServiceInfoResult','http://www.strikeiron.com','ServiceInfoOutput','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'GetServiceInfoResult'};
    }
    public class GetCityStateResponse_element {
        public zipInfoLookup.ZipInfoOutput GetCityStateResult;
        private String[] GetCityStateResult_type_info = new String[]{'GetCityStateResult','http://www.strikeiron.com','ZipInfoOutput','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'GetCityStateResult'};
    }
    public class GetAllStatusesResponse_element {
        public zipInfoLookup.StatusCodeOutput GetAllStatusesResult;
        private String[] GetAllStatusesResult_type_info = new String[]{'GetAllStatusesResult','http://www.strikeiron.com','StatusCodeOutput','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'GetAllStatusesResult'};
    }
    public class ServiceInfoOutput {
        public zipInfoLookup.SIServiceInfoResult ServiceResult;
        private String[] ServiceResult_type_info = new String[]{'ServiceResult','http://www.strikeiron.com','SIServiceInfoResult','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{'ServiceResult'};
    }
}
// Here is the wrapper
global class StrikeIronWrapper {
 webservice static zipInfoLookup.ZipInfoOutput wrapper(string varZipCode){
  //zipInfoLookup zipInfoLookupCls = new zipInfoLookup();
  zipInfoLookup.zipinfoSoap zip = new zipInfoLookup.zipinfoSoap();
  zip.LicenseInfo = new wsStrikeironCom.LicenseInfo();
  zip.LicenseInfo.RegisteredUser = new wsStrikeironCom.RegisteredUser();
  zip.LicenseInfo.RegisteredUser.UserID = 'test@test.com';
  zip.LicenseInfo.RegisteredUser.Password = 'test';
  //zipInfoLookup.ZipInfoOutput zipinfo = zip.GetCityState('06010');
  zipInfoLookup.ZipInfoOutput zipinfo =  zip.GetCityState(varZipCode);
  return zipinfo;
 }
}