function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vijay ZutshiVijay Zutshi 

APEX Trigger to recreate ZIP Code spreadsheet as a custom Territory object

I have to recreate a ZIP Code spreadsheet. The custom object will have following fields:

1. Zip Code (Text) - The standard name field. Each record will be named after its specific zip code
2. Owner - Lookup(User) - The standard owner field. The sales rep assigned to this territory.

As I am new to APEX please help as I am stuck and not able to move further.

Thanks
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Vijay,

Can you try checking the below link that has an example of your implementation:

>> https://developer.salesforce.com/forums/?id=906F000000096tVIAQ
 
<apex:page standardController="Account" contenttype="application/vnd.ms-excel">
   <apex:pageBlock title="Contacts">
      <apex:pageBlockTable value="{!account.Contacts}" var="contact">
         <apex:column value="{!contact.Name}"/>
         <apex:column value="{!contact.MailingCity}"/>
         <apex:column value="{!contact.Phone}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
   </apex:page>

I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be useful for others in the future.

Regards,
Anutej 
 
Vijay ZutshiVijay Zutshi
HI Anutej, 
Thanks for your reply but I would appreciate if you can give a solution using just Trigger not through visualforce page or you can also tell me the steps to follow.

Thanks
Vijay