• MattiasNordin.ax607
  • NEWBIE
  • 5 Points
  • Member since 2009

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

Im trying to learn visual force pages and want to add information from the campaign object on a contact visual force page. How can that be done?`

I guess the URL need to contain input for both objects. How does that work?

 

https://flir.secure.force.com/offer?id=0032000000PTk9aAAD&rCC=1234

 

id=0032000000PTk9aAAD is somehow inputted to the contact controller. How do i send input to the custom class that fetches info from the campaign object.

 

(im new to java. have only scripting experience. trying to learn)

Hi,

 

Can someone explain to me how to write a test class for an apex trigger like the following one?

 

trigger trgMnUpdateContactFieldsFromUserTable on Contact (before update, before insert) {

    Set<Id> userIds = new Set<Id>();
    for (Contact a : Trigger.new)
        userIds.add(a.OwnerId);
    
    // Query the User table for the associated fields you need and place in a map.
    Map<Id, User> fields = new Map<Id, User>([select Name, User_Region__c from User where id in :userIds]);
    
    // Now use the map to set the appropriate fields on every Account processed by the trigger.
    for (Contact a : Trigger.new) {
        
        // OWNER NAME FROM USER TO ACCOUNT
        a.Owner_name_txt__c = fields.get(a.OwnerId).Name;

        // OWNER REGION FROM USER TO ACCOUNT
        a.Owner_region__c = fields.get(a.OwnerId).User_Region__c;

    }    
}

 

 

I would like to add a custom build google maps application in sales force. I need my accounts to have the google maps lat lang data stored in a field. The following javascript function returns that data. How can i embed this script and have it executed everytime an account is saved?

 

 

[code] 

<script>

var geocoder;
function funReturnCoordFromAddress(address) {
 if (geocoder) {
  geocoder.geocode(
   {'address': address}, function(results, status){
   if (status == google.maps.GeocoderStatus.OK) {
    
    map.setCenter(results[0].geometry.location);
    
    var marker = new google.maps.Marker({
     map: map, 
     position: results[0].geometry.location
    });
   
    
    //alert(results[0].geometry.location)
    
    document.getElementById("target").value = results[0].geometry.location
    //return results[0].geometry.location
 
   }else{
    alert("Geocode was not successful for the following reason: " + status);
   }
  });
    }

}


</script>

[/code]

Hi, Sites looks like fun. This is my first test. Can someone help me by explaining how you pass on the contact ID to the site page. The problem im having is whenever i test (dont know if i use the correct syntax) i get the...

 

"Authorization Required

You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it. "

 

...message. Im using the following apex code on my page:

 

 

 <apex:page standardController="Contact" sidebar="false" showHeader="false">

  <h1>Mattias visual force concept page2</h1>

    <apex:form id="theForm">
     First name =  <apex:outputField value="{!contact.FirstName}"/>
    </apex:form>

</apex:page>

 

And access the page with the following URL:

 

http://flir.force.com/test/

 

So far so good.

 

But when i try to add the contact id using:

 

http://flir.force.com/test/?id=0032000000QRu5B

 

I get the authorization requred message. What am i doing wrong?

 

 

Hi,

 

Can someone explain to me how to write a test class for an apex trigger like the following one?

 

trigger trgMnUpdateContactFieldsFromUserTable on Contact (before update, before insert) {

    Set<Id> userIds = new Set<Id>();
    for (Contact a : Trigger.new)
        userIds.add(a.OwnerId);
    
    // Query the User table for the associated fields you need and place in a map.
    Map<Id, User> fields = new Map<Id, User>([select Name, User_Region__c from User where id in :userIds]);
    
    // Now use the map to set the appropriate fields on every Account processed by the trigger.
    for (Contact a : Trigger.new) {
        
        // OWNER NAME FROM USER TO ACCOUNT
        a.Owner_name_txt__c = fields.get(a.OwnerId).Name;

        // OWNER REGION FROM USER TO ACCOUNT
        a.Owner_region__c = fields.get(a.OwnerId).User_Region__c;

    }    
}