So I have a some java script where I want to pass a list of Objects from a controller and get a number of fields. However, I'm having issues passing the individual variables.
However, I'd rather call the controller (I think it's better form)
Apex:
public List<Activity__C> getActs(){
myActs = [select Task_Site__c, Activity_Date__c, Activity_Time_Stamp__c,GeoCode__Latitude__s, GeoCode__Longitude__s, workday__r.owner.name
from Activity__c
where workday__r.ownerid =: curUser and Activity_Date__c =: filter ];
return myActs;
}
Javascript/VF
From my controller how can I access the Task_Site__C and other fields via Javascript?
<script type="text/javascript">
var result = new Array();
result = '{!Acts}';
//sforce.connection.sessionId = "{!$Api.Session_ID}";
//sforce.connection.query('select Task_Site__c, Activity_Date__c, Activity_Time_Stamp__c,GeoCode__Latitude__s, GeoCode__Longitude__s, workday__r.owner.name from Activity__c');
for (var i=0; i < result.length; i++)
{
console.log(result[i].Task_site__c);
}
}
sforce.connection
. They wouldn't have opened up the API if they didn't want people using it.