• Nuno.Carvalho
  • NEWBIE
  • 60 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 30
    Replies
I´m trying to put a google maps on my standard object "Account" , i´m using the billing adress for the location, the map works fine for a few seconds than it appears this message:
User-added image

The code i´m using for this is:

<apex:page standardController="Account">
<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 ="{!Account.BillingStreet},{!Account.BillingPostalCode}{!Account.BillingCity}, {!Account.BillingState},{!Account.BillingCountry}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingState}<br>{!Account.BillingCountry}"
});
 
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: "{!Account.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! {!Account.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;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
I need to copy a currency field on the standard object “contract” called salary__c to the right player on the costum object “players__c” and the field has the same name. I got 5 record types on contract , the one with that field is Transfer.
Thanks in advance.
Nuno C
Hello guys,
I have a button that converts the record on young_prospects__c to a new record on the object players__c,
All i want to do is to delete the old record on the young_prospects__c, 
If you need to know more feel free to ask, and sorry if i didn´t explain myself right,
Thank you,
Nuno.
Hello Guys,
Im trying to create a flow for a button , 

User-added image

This flow works for another button that i created, but now i need to chose the right recordType for creating the record, but i dont know how.
If you need more info, feel free to ask, really need some help, 
Regards,
Nuno.
Hi guys,
I need to create a button onclick to update a date field on contracts , all i want to do is to extend the contract 2 years. 
I´m new to creating buttons , so if you can explain to me how to do it i would be very appreciated.
User-added image
Final do Contrato means Contract expiration date.
That´s de field i want to update, 
Regards,
Nuno.
Hello guys,
I need to create a button on a custom object called (young_prospects__c) to convert them to (players__c).
I want to copy some information , because the information on the 2 objects are basically the same.
(players__c) is another custom object.
If you need more information or i didn´t explain myself right , please feel free to ask,
Thank you, 
 Nuno.
 
Hello guys,
I need to copy a value from one recordtype to another, can i do it?
With a formula field or a workflow... i don´t really know.
Hi guys,
Im trying to populate the account name lookup field on contracts with the right account , first of all i need to know if its possible to create this trigger because the account name lookup field is required and i can´t save it with any value as you guys know... 
You can ask me what you need to know , i will try my best to help you, help me :)
Hi guys,
Im new to apex so i need some help with this code if possible.
I want to fill a lookup field in Contracts, with the right Contact.
I need this trigger to be on a Costum object called Players__c , that object has 2 lookups one to Contract called represented_player__c and another to Contacts called represented_by__c.
If i need to tell you more just feel free to as me anything.
Thank you
Hello guys,
Im trying to auto-fill a field called clube, i think i´ve done the right thing , because this method worked for similar updates, i just changed the fields a wanted to compare.
The erros that gives me in debug logs is "System.QueryException: List has no rows for assignment to SObject", i know what this means i just dont know how to make this right.

Translations:
-clube (soccer club)
-jogador_representado ( represented player)
-jogadores (players)

trigger clube on Jogadores__c (before update) {
string ids;
    list <Contract> c = [Select id,Jogador_Representado__c,Clube__c from Contract];
    for(Jogadores__c i : trigger.new) {
       ids = i.id;
    }
    jogadores__c j = [Select id,name ,Clube__c From jogadores__c Where id = : ids];
    if(j.name !=null) {
         Contract con = [Select Jogador_Representado__c From Contract where id =: j.name limit 1];
               for (Contract ctt : c){
                    if(ctt.Jogador_Representado__c == con.Jogador_Representado__c ){
                    ctt.Clube__c = j.Clube__c;
               update ctt;
        }
      }
    }
}

Would aprecciate some help, thank you.
Hello guys im new to apex triggers.
I have 2 objects, standard (Contract) and costum (soccerplayers__c).
I want to create a trigger that updates Contracts start date in soccerplayers__c based on the value i puted in Contracts.
I am trying to compare the different contracts based on the players name, i have a lookup between the two objects.
The Name field on contract is (player_represented_by__c) and on soccerplayers__c is (Name). Ps: this is the name of the lookup fields.
If i didn´t express myself right you can ask me, i will try to answer.

 
I´m trying to put a google maps on my standard object "Account" , i´m using the billing adress for the location, the map works fine for a few seconds than it appears this message:
User-added image

The code i´m using for this is:

<apex:page standardController="Account">
<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 ="{!Account.BillingStreet},{!Account.BillingPostalCode}{!Account.BillingCity}, {!Account.BillingState},{!Account.BillingCountry}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingState}<br>{!Account.BillingCountry}"
});
 
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: "{!Account.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! {!Account.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;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
I need to copy a currency field on the standard object “contract” called salary__c to the right player on the costum object “players__c” and the field has the same name. I got 5 record types on contract , the one with that field is Transfer.
Thanks in advance.
Nuno C
Hello guys,
I have a button that converts the record on young_prospects__c to a new record on the object players__c,
All i want to do is to delete the old record on the young_prospects__c, 
If you need to know more feel free to ask, and sorry if i didn´t explain myself right,
Thank you,
Nuno.
Hello Guys,
Im trying to create a flow for a button , 

User-added image

This flow works for another button that i created, but now i need to chose the right recordType for creating the record, but i dont know how.
If you need more info, feel free to ask, really need some help, 
Regards,
Nuno.
Hi guys,
I need to create a button onclick to update a date field on contracts , all i want to do is to extend the contract 2 years. 
I´m new to creating buttons , so if you can explain to me how to do it i would be very appreciated.
User-added image
Final do Contrato means Contract expiration date.
That´s de field i want to update, 
Regards,
Nuno.
Hello guys,
I need to create a button on a custom object called (young_prospects__c) to convert them to (players__c).
I want to copy some information , because the information on the 2 objects are basically the same.
(players__c) is another custom object.
If you need more information or i didn´t explain myself right , please feel free to ask,
Thank you, 
 Nuno.
 
Hello guys,
I need to copy a value from one recordtype to another, can i do it?
With a formula field or a workflow... i don´t really know.
Hi guys,
Im trying to populate the account name lookup field on contracts with the right account , first of all i need to know if its possible to create this trigger because the account name lookup field is required and i can´t save it with any value as you guys know... 
You can ask me what you need to know , i will try my best to help you, help me :)