• Shahroz Beg
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I m trying to access a the apex Map named  "resultsMap" with javascript, I would like to get contact last name using contact id.
public class AccessMapJS {
	public Map<ID, Contact> resultsMap{get;set;} 
	public String JsonMap{get;set;} 
	
	public AccessMapJS(){
		resultsMap = new Map<ID, Contact>([SELECT Id, LastName FROM Contact limit 3]);
		JsonMap=JSON.serialize(resultsMap); 
	}
}

VF page:
<apex:page controller="AccessMapJS" >
<script>
// Access here resultsMap: get contact last name using contact id

</script>
  {!resultsMap}
</apex:page>

Do you know hoe to accomplish that ?
Thanks in advantage for any advice.
 

Relitively new to this platform. Trying to create a really simple trigger on a Task. I took out any of my code in the actual trigger, but every time I try to save I get a "[object Object]: duplicate value found: ScopeId duplicates value on record with id" error message. I really have no idea where to start with this one.


trigger updateNameToPrimary on Task (before insert, before update) {

}

 

 

I need to check datatype for some fields of my custom object.

String type= 'MyCustomObject__c'; // Say,this is my object
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
for (String fieldName: fieldMap.keySet()) {
String mylabel;
//It provides to get the object fields label.
mylabel = fieldMap.get(fieldName).getDescribe().getLabel();
}
Now this type i.e. Object Name is varying time to time and I need to check fields data type.