• robdobby
  • NEWBIE
  • 175 Points
  • Member since 2013
  • Sr. Salesforce Developer
  • OpFocus

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 40
    Replies
Hello,

I'd appreciate help in combining these 2 triggers - I need to keep the functionality of both intact.  Thank you in advance!!

1st one:
trigger linkGoLiveDate on Opportunity (after insert, after update) {

    Set<ID> myAccountIds = new Set<ID>();
    Map<ID, Date> myMap = new Map<ID, Date>();
    
    for (Opportunity o : Trigger.new) {
        if (o.go_live_date__c != null && o.accountid != null) {
            myAccountIds.add(o.accountid);
            myMap.put(o.accountid, o.go_live_date__c);
        }   
    }
    
    if (myAccountIds.size() > 0) {
        List<Account> myAccounts = new List<Account>();
        for (Account a : [select id from account where Service_Start_Date__c = NULL AND id in :myAccountIds]) {
            a.service_start_date__c = myMap.get(a.id);
            myAccounts.add(a);
        }
        
     update myAccounts;
    }

}

2nd one:
trigger updateAccountOwner on opportunity (after insert, after update){
    list<Id> accIds = new list<Id>();
    list<Account> accounts = new list<account>();
    for(opportunity o:trigger.new){
        accIds.add(o.accountId);
    }
    for(account a:[select Id, ownerid from account where Id IN :accIds]){
        for(opportunity opp:trigger.new){
            if(opp.StageName == 'Live'){
                a.ownerid=opp.client_service_rep__c;
                accounts.add(a);
            }
        }
    }
    update accounts;
}

 
Hi Experts,

Below trigger working sucessfully in single Account Standard Object. But i need test trigger for deployment from Sandbox to Production.

trigger ExecutiveOwner on Account(before insert, before update){
    Account Owner = [Select Executive_Owner__c from Account Where Account.Strategic__c= null or Account.Strategic__c= 'No' limit 1];
        Owner.Executive_Owner__c = null;
}

Below is fields Info on Account:
Strategic__c
Executive_Owner__c

Please anyone help me.
Thanks in Advance.

Thanks,
Manu
I am trying to set properties on a column using a stylesheet instead of embedded style values. However I cannot get the stylesheet method to work when applying color to the text. I am fairly new to VF and this is my first time trying to use a custom stylesheet.

Here is the component that renders correctly using style option: 
<apex:column value="{!i.Display_Value6__c}" style="background:#DAF6FF;color:red"/>

Here is the component using the stylesheet which correcly applies the background color but not the font color: 
<apex:stylesheet value="{!$Resource.InventoryStyleSheet}"/>
<apex:column value="{!i.Display_Value6__c}" styleClass="colorstyle_red"/>

here is the contents of the style sheet which I've uploaded as a static resource.
.colorstyle_red { 
background: #DAF6FF; 
color:red; }
  • February 26, 2015
  • Like
  • 0
Hey there,

I have an email template that is designed to send information in regards to a course.

I have found this way of inserting google maps into visualforce online. Basically, you insert address information into the record and the code uses this to search and then paste the code.

i tested the template and merge fields and the google maps came up and everything was perfect. However, when I try and email it to someone to test both my signature image and google maps does not appear. What could be the problem?

This is my code, thank you in advances for your tiem!!

<messaging:emailTemplate subject="EPE Course Confirmation" recipientType="Contact" relatedToType="EPE_Course__c">
<messaging:htmlEmailBody > 
<html>
<head>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 

$(document).ready(function() {

  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }

  var map;
  var marker;

  var geocoder = new google.maps.Geocoder();
  var address = "{!relatedTo.Street__c}, " + "{!relatedTo.Suburb__c}, " + "{!relatedTo.Post_Code__c}, " + "{!relatedTo.Country__c}";

  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!relatedTo.Name}</b><br>{!relatedTo.Street__c}<br>{!relatedTo.Suburb__c}, {!relatedTo.Post_Code__c}<br>{!relatedTo.Country__c}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        //center map
        map.setCenter(results[0].geometry.location);

        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!relatedTo.Name}"
        });

        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });

      }

    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!relatedTo.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });

  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }

});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  width:350px;
  background:transparent;
}
</style>

</head>



<body>



<p><div id="map"></div></p>



<p>Kind Regards,</p>


<p>The Destiny {!relatedTo.Office_Name__c} Team </p>

<img alt="" src="{!$Resource.Destiny_Logo}" />




</body>
        </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>


HI,

 

  Is it possible that I can create a embedded Visual Force Page which can redirect to another Visual Force Page that will not be embedded into the Standard Controller parent page? I want the embedded page to function like the Command Buttons for a Standard Object's detailed page which, when created using a URL to another page can redirect you from that  Standard Object page to a Visual Force Page which exists outside of the the contact  detailed record page.  In other words a free standing Visual Force Page.

 

For example:

Say you have some contacts who are associated with an account and you would like to create a button on the Contact record  detail page that will call another page to create an opportunity for that Contact record. YOu can do this by creating a Command button and then  creating a URL link with account and contact IDs as parameters.

 

Q) Can we also do this with an Embedded Visual Force Page which contains a command button to redirect to a page outside of the Contact Detail record page?

 

 I am using a pick list of values  for this embedded page that resides within a page block section.  Underneath that pick list is a button which will redirect to another page when clicked but that new page now becomes embedded and overwrites the previous embedded page block section. I want that new page to be a free standing Visual Force Page.

 

 Thanks for your help.

hello,

 

I have the below vf page as below. When I click the section label ({!section.Section_Label__c}) it would rerender questiondetail block and the page should scroll with top being the data from reender but when I click if I try to scroll to any componenet in the questiondetail block it didnt work,so I had to do it the way below which just shifts littlle not to the start of the data below button.I think it may be because it takes time for data to come from backend.

Q1)Is there any other way I can scroll to the data below save button.

Q2)Is there a way to have some event fire only when the data is completely loaded into the frontend and than scroll or do something.

 

<script language="JavaScript" type="text/javascript">

function scrollWin() {
window.scrollTo(0, 800);

}

</script>

<apex:form id="templateForm">

<apex:pageBlock >


<apex:pageBlockSection id="sectionBlock" title="{!templateName}" columns="1">
<apex:repeat value="{!sectionsStatusLists}" var="section">
<apex:commandLink reRender="questiondetail" onclick="scrollWin()">
<h3>{!section.Section_Label__c}
</h3>
<apex:param name="sectionId" value="{!sectionid}"/>
</apex:commandLink>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>

<apex:outputPanel id="questiondetail" >
<apex:pageBlock id="block1">

<script>
function focu(){
var e = document.getElementById('{!$Component.buttons1.button1}');
//var e = document.getElementById('thePage:templateForm:questiondetail:block1:buttons1:button1');
e.focus();
}
</script>
<apex:pageBlockButtons location="bottom" id="buttons1" >
<apex:commandButton value="Save" action="{!Save}"  id="button1"/>
</apex:pageBlockButtons>

<apex:repeat value="{!questionsList}" var="question" >

<apex:pageBlockSection columns="1" rendered="{!question.newquestFormat.Question_Type__c=='Text'}" >

<apex:pageBlockSectionItem >
<apex:outputField value="{!question.Subquestion_Label__c}" />
<apex:inputTextarea style="" rows="6" cols="100" id="textInfo" value="{!question.resObj.Response__c}"></apex:inputTextArea>
</apex:pageBlockSectionItem>
</apex:pageBlockSection><br></br>

<apex:pageBlockSection columns="1" rendered="{!question.Question_Type__c=='RadioPicklist'}" >
<apex:outputPanel rendered="{!NOT(ISNULL(question.HelpText__c))}"><b>Q.{!qnum} {!question.Question_Label__c}</b><span class="helpButton" id="help1_Help"><img src="/s.gif" alt="" class="helpIcon" title="{!question.newquestFormat.HelpText__c}"/></span>
</apex:outputPanel>

<apex:pageBlockSectionItem >
<apex:selectRadio layout="pageDirection" id="qOptionList" value="{!question.resObj.Response__c}">
<apex:selectOptions value="{!question.optionsList}"/>
</apex:selectRadio>
</apex:pageBlockSectionItem>
</apex:pageBlockSection><br></br>
</apex:repeat>
</apex:pageBlock>

</apex:outputPanel>

</apex:form>

 

  • February 07, 2013
  • Like
  • 0
Hello,

I'd appreciate help in combining these 2 triggers - I need to keep the functionality of both intact.  Thank you in advance!!

1st one:
trigger linkGoLiveDate on Opportunity (after insert, after update) {

    Set<ID> myAccountIds = new Set<ID>();
    Map<ID, Date> myMap = new Map<ID, Date>();
    
    for (Opportunity o : Trigger.new) {
        if (o.go_live_date__c != null && o.accountid != null) {
            myAccountIds.add(o.accountid);
            myMap.put(o.accountid, o.go_live_date__c);
        }   
    }
    
    if (myAccountIds.size() > 0) {
        List<Account> myAccounts = new List<Account>();
        for (Account a : [select id from account where Service_Start_Date__c = NULL AND id in :myAccountIds]) {
            a.service_start_date__c = myMap.get(a.id);
            myAccounts.add(a);
        }
        
     update myAccounts;
    }

}

2nd one:
trigger updateAccountOwner on opportunity (after insert, after update){
    list<Id> accIds = new list<Id>();
    list<Account> accounts = new list<account>();
    for(opportunity o:trigger.new){
        accIds.add(o.accountId);
    }
    for(account a:[select Id, ownerid from account where Id IN :accIds]){
        for(opportunity opp:trigger.new){
            if(opp.StageName == 'Live'){
                a.ownerid=opp.client_service_rep__c;
                accounts.add(a);
            }
        }
    }
    update accounts;
}

 
Hi Experts,

Below trigger working sucessfully in single Account Standard Object. But i need test trigger for deployment from Sandbox to Production.

trigger ExecutiveOwner on Account(before insert, before update){
    Account Owner = [Select Executive_Owner__c from Account Where Account.Strategic__c= null or Account.Strategic__c= 'No' limit 1];
        Owner.Executive_Owner__c = null;
}

Below is fields Info on Account:
Strategic__c
Executive_Owner__c

Please anyone help me.
Thanks in Advance.

Thanks,
Manu
Hi! I am very new to visualforce page. I am trying to nest a very simple VF page with checkboxes within the event detail page. However, I cannot save my checkbox values. Every time I hit save, it refreshes the page and then the checked boxes become unchecked again. I do not know why that happens. Could anybody please tell me why and how I can fix it? Thank you very much!
<apex:page standardController="Event">
    
    <apex:detail subject="{!event}" relatedList="false"/>
    
    <apex:form id="theForm">
    
        <apex:pageBlock title="Event Check List" id="thePageBlock" mode="detail">
    
            <apex:pageblockButtons >
                <apex:commandButton action="{!save}" value="Save" id="save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
                <apex:message for="save"/>
            </apex:pageblockButtons>
            
            <apex:actionSupport event="onclick" reRender="theBlock" action="{!save}"/>
                
            <apex:pageBlockSection columns="2" >
                <apex:inputCheckbox id="repregis" label="Representatives registered" onselect="{!event}"/>
                <apex:inputCheckbox id="boothregis" label="Booth registered"/>
                <apex:inputCheckbox id="payment" label="Payment made"/>
                <apex:inputCheckbox id="hotel" label="Hotel booked, if applicabale"/>
                <apex:inputCheckbox id="litsent" label="Literature sent"/>
                <apex:inputCheckbox id="boothsent" label="Booth sent"/>
                <apex:inputCheckbox id="promosent" label="Promotional materials sent"/>
                <apex:inputCheckbox id="Misc" label="Miscellaneous stuffs sent"/>
                <apex:inputCheckbox id="furniture" label="Furniture ordered"/>
            </apex:pageBlockSection>
        
        </apex:pageBlock>
    
    </apex:form>
    
    <apex:relatedList list="Attachments"/>
    
</apex:page>
Thank you in Advance.
 
I am salesforce certified system administrator. My question is that I want to learn Apex Trigger & Visual Force. However I am from non-programming background. So in order to learn apex trigger and visual force do I need to also learn C, C++, Java core & Java advanced. Please help me with the same. What i need to learn in order to understand.
 
Regards
Ehtesham Qureshi
I am trying to set properties on a column using a stylesheet instead of embedded style values. However I cannot get the stylesheet method to work when applying color to the text. I am fairly new to VF and this is my first time trying to use a custom stylesheet.

Here is the component that renders correctly using style option: 
<apex:column value="{!i.Display_Value6__c}" style="background:#DAF6FF;color:red"/>

Here is the component using the stylesheet which correcly applies the background color but not the font color: 
<apex:stylesheet value="{!$Resource.InventoryStyleSheet}"/>
<apex:column value="{!i.Display_Value6__c}" styleClass="colorstyle_red"/>

here is the contents of the style sheet which I've uploaded as a static resource.
.colorstyle_red { 
background: #DAF6FF; 
color:red; }
  • February 26, 2015
  • Like
  • 0
Hello dear community, I'm having a very difficult time getting this test class working, whenever I try executing it no matter what I did it's giving me this error: System.QueryException: List has no rows for assignment to SObject. 
I already looked up in my account for the test name which is mentioned in the query, I found it but it still since I get this error it doesn't seem to return anything. When I look up in account, under accountname,am I supposed to pick the name for my test there and use it in my test code or what else do I need to put in exactly?
Please have a look on the classes:

@isTest(SeeAllData=true)
private class HelperContactTriggerTestneu {
public static testMethod void myTestMethod() {

        Account acc = new Account(Name = 'Test Test');
      
        {
        insert acc;

        List<Account> sendMail = [select id from account where (Name='Test Test') and id=:acc.id];
        
        test.startTest();

        HelperContactTrigger.sendEmail(sendMail);
        test.stopTest();
        System.assert(acc !=null);
        }
        }
        }
________________________________________________
public with sharing class HelperContactTrigger {
    //static method
    public static List<Account> sendEmail(List<Account> accounts) {

        //query on template object
        EmailTemplate et=[Select id from EmailTemplate where name='Neuer Kunde'];

        //list of emails
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();

        //loop
        for(Account con : accounts){

            //check for Account
            if(con.PersonEmail == null && con.PersonEmail != null){

                //initiallize messaging method
                Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();

                //set object Id
                singleMail.setTargetObjectId(con.Id);

                //set template Id
                singleMail.setTemplateId(et.Id);

                //flag to false to stop inserting activity history
                singleMail.setSaveAsActivity(false);

                //add mail
                emails.add(singleMail);
            }
        }
        //send mail
        Messaging.sendEmail(emails);

        return accounts;
    }
}

Thanks in advance :)
Hi There , 

iI need to get the all the input field values form the visualforce page.
<apex:inputField value="{!UpdateAllRecord[fieldName]}" 
                                                                             required="false"
                                                                             styleClass="updateAllInput"/>
I was able to first value using  below line

var inputvalue=jQuery("input.updateAllInput").val();

I was trying to get all the values using but I am not getting 
 $("input.updateAllInput").each(function(){
             var input = $(this); // 
            });

Can any one suggest me what is wrong with my jQuery

Requirement is get all the input fields, is any one one othe input field is having value then display some confirmation message.
 
Is there a way to force Salesforce to edit all Active Contract records?

I have a need for an Apex trigger to run when a certain date is hit, however it will be unlikely that the record will be updated when that date is hit (so no Update or Edit) and the date with which to run the trigger will be variable (so no pre-determined time delay of X months).

 
I have a web application that uses the Salesforce API to create Contact, Account, Opportunity records. We set up an administrator user with full permissions to use as the Oauth login user, and I use it as an admin for development. I went on vacation so this system admin user was being used for API access only for over a week.

Then all of a sudden the system started returning errors to me (using Django/Python for my client, pasting verbatim) 
SalesforceError: {u'errorCode': u'CANNOT_REPARENT_RECORD', u'fields': [], u'message': u'owner is inactive, cannot reparent record'}

Thing is the owner in this case should be the system user I created and any other records that would have been touched with it are owned by active users. I logged into the SF web interface with my admin user, the errors stopped but I'm not sure if it was related.

My question is - is it possible that the user was flagged as inactive automatically? I can't find a setting that would change this. Would it be caused by something else or am I on the right track?

I've gotten over the first hurdle and was able to create a batch class and a schedule class that writes data to a custom target object. I found the following thread a great tutorial for the batch and schedule classes https://developer.salesforce.com/forums/ForumsMain?id=906F00000009FXSIA2.

Now I'd like to put the classes into production and need some help. I found the following article lacking for my specific example: http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex_batch_2.htm. In my circumstance I am using a query locator and am not finding test examples that align.

global class SnapshotOpenCasesBatch implements Database.Batchable<sObject> 
 {
	
	//Gather all the records I want to use in the execute method
	global Database.QueryLocator start(Database.BatchableContext BC) 
	{
        return Database.getQueryLocator([SELECT ID, OwnerID, Name, Case_Type__c, Subtype__c, Status__c, Reason__c, Case_Age_Days__c, CreatedDate FROM Custom_Case__c WHERE Status__c in ('New', 'Work in Process', 'Escalated', 'Solution Proposed/Validation') ORDER BY CreatedDate ASC]); // Production source field is Created_Date__c
	}
	
	global void execute(Database.BatchableContext BC, List<Custom_Case__c> openCases) 
	{
    
            //for creating new Snapshot batch.
            List<Snapshot_Open_CASE__c> newSnapshot = new List<Snapshot_Open_CASE__c>();
            
        	//create map collection to pair case owner ID and full name 
            Map<ID, String> userMap = new Map<ID, String>(); 
    
            //add all OwnerId values from openCases List to the set of userIds for query
            Set<ID> userIdSet = new Set<ID>();
            
            for (Custom_Case__c c : openCases) {
                userIdSet.add(c.OwnerID);
            }
         
            //Go get all the User ID + name combos from the set of Ids created above
            List<User> userList = new List<User>([SELECT ID, Name FROM User WHERE ID in : userIdSet]);
        
            //Load userMap with the results of the query above
            for(User u : userList){
                userMap.put(u.id, u.Name);
            }   
        
            for (Custom_Case__c c : openCases) {
                Snapshot_Open_CASE__c snap = new Snapshot_Open_CASE__c();
                snap.CASE_ID__c = c.ID;
                snap.OwnerID__c = c.OwnerID;
                snap.Case_Number__c = c.Name;
                snap.Case_Type__c = c.Case_Type__c;
                snap.Subtype__c = c.Subtype__c;
                snap.Status__c = c.Status__c;
                snap.Reason__c = c.Reason__c;
                snap.Case_Age_Days__c = c.Case_Age_Days__c;
                snap.Created_Date__c = c.CreatedDate.date(); // Production source field is Created_Date__c // also convert datetime to date
                snap.Name = String.valueof(Date.today()); // Use execution date as unique id
                
                // add the user name
                snap.Owner_Full_Name__c = userMap.get(c.OwnerId);
                    
                //load up the data for insert
                newSnapshot.add(snap);
        		}

    		insert newSnapshot;
			}
	
	global void finish(Database.BatchableContext BC) {
		system.debug('Batch Job is Complete');
	}
}
More high level, and nice to have but not critical, can someone explain the composition of how a test class should be constructed with respect to a batch? Don't need to get too much into theory but that would be helpful. For example, in some articles an 'a-ha' moment comes from adding a LIMIT 200 records clause to the SOQL, but what's the reasoning behind that?

Thanks!
  • November 14, 2014
  • Like
  • 0
Error: Compile Error: Didn't understand relationship 'Invoice_Statement__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 4 column 1



trigger HandleProductPriceChange on Merchandisenew__c(after update)
{
List<Line_Item__c> openLineItems =
[select j.Unit_price__c, j.Merchandise1__r.Price__c
from Line_Item__c j
where j.Invoice_Statement__r.Status__c='Negotiating'
and j.Merchandise1__r.id IN : Trigger.new
for UPDATE];
}
Hi Guys,

I have a small doubt with regards to the Required Check box.

I have created a picklist field without making it required now I want that field to required whiere I am unable to see the option of Required check box I know that I can make it using Validation Rules and why it is possible with the Test or other fields.Can anyone explain me please.

RegardsUser-added imageUser-added image
I have (what I believe is) a free developer edition.

Is it possible to implement sites on this org?

I see Apex and Pages under Development along with all the other stuff but I don't see sites anywhere.

Anyone know if this can be done?
In one of our lead environments, we have added a Account lookup to the lead. When the lead is "sales ready" (Custom field "MSD Sales Ready", Checkbox (True)), then we would like to convert all the leads with that Account link to contacts using the account link as the account that the contacts are created in.

That means we need to select the existing account and then create the contact, but also anyother lead with that account link as well.

Any ideas?
  • September 22, 2014
  • Like
  • 0
Having a bit of trouble with this trigger. need some help please...

I want to create a task when a checkListItem is updated. Task should upserted in case existing task for the checklist is not closed. This code is always creating a new task irrespective of existing taks. How to fix this? 

//test

trigger AssignCalendarTask  on Checklist_Item__c (before update){ 
	
	List<Task> tasks = [Select id, whatid, status from task where status <>'Closed']; 
	
	List<Checklist_Item__c> Itms = Trigger.new; 
		
		for (Checklist_Item__c Itm : Itms) {
				
				If (Itm.Active__c && Itm.Responsible__c <> null && Itm.Next_Activity__c <> null) {
				
					Task tsk = new Task(whatID = Itm.ID,
					Ownerid = Itm.Responsible__c,
					Subject = Itm.Activity_Type__c,
					Status = 'Assigned',
					Description = 'This is a system assigned Task.', 
					ActivityDate = Itm.Next_Activity__c,
					ReminderDateTime=Itm.Next_Activity__c - 3,
					IsReminderSet=true);  
		
		tasks.add(tsk); } 
	
		}
		
		upsert tasks; 
		
}



  • September 22, 2014
  • Like
  • 0
Hi,

Can some one help me how to display radio button with image as shown below.

User-added image

Thanks in advance.
hey all,

I'm basically doing a table with <repeat> tags, using a HTML <table> as a base.
The problem is that inputText tag doesn't want to fit inside <td> tags.

Here is a screenshot (sorry for size, I'm using offseted dual monitors)
http://i.imgur.com/HTqSc86.jpg

on left screen you can see the code. And on right screen, the buggy result.

Help appreciated
Hey there,

I have an email template that is designed to send information in regards to a course.

I have found this way of inserting google maps into visualforce online. Basically, you insert address information into the record and the code uses this to search and then paste the code.

i tested the template and merge fields and the google maps came up and everything was perfect. However, when I try and email it to someone to test both my signature image and google maps does not appear. What could be the problem?

This is my code, thank you in advances for your tiem!!

<messaging:emailTemplate subject="EPE Course Confirmation" recipientType="Contact" relatedToType="EPE_Course__c">
<messaging:htmlEmailBody > 
<html>
<head>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 

$(document).ready(function() {

  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }

  var map;
  var marker;

  var geocoder = new google.maps.Geocoder();
  var address = "{!relatedTo.Street__c}, " + "{!relatedTo.Suburb__c}, " + "{!relatedTo.Post_Code__c}, " + "{!relatedTo.Country__c}";

  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!relatedTo.Name}</b><br>{!relatedTo.Street__c}<br>{!relatedTo.Suburb__c}, {!relatedTo.Post_Code__c}<br>{!relatedTo.Country__c}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        //center map
        map.setCenter(results[0].geometry.location);

        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!relatedTo.Name}"
        });

        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });

      }

    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!relatedTo.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });

  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }

});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  width:350px;
  background:transparent;
}
</style>

</head>



<body>



<p><div id="map"></div></p>



<p>Kind Regards,</p>


<p>The Destiny {!relatedTo.Office_Name__c} Team </p>

<img alt="" src="{!$Resource.Destiny_Logo}" />




</body>
        </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>