• MattLacey.ax1065
  • 320 Points
  • Member since 2011

  • Chatter
  • 12
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
  • 95


I am not able to Save and Deploy the application using Standalone Force.com IDE , it is giving me an error like

'Synchronized Check Failed'

Can you please guide how to resolve this error.



Save error: Invalid bind expression type of SOBJECT:AggregateResult for Id field of SObject Contact



List<contact>  cnt = new List<Contact>([select id, name, from contact where contact.id =: [select max(id) from contact]]);

Apex Documentation shows this when selecting for 'person account' objects:

SELECT Name, SobjectType, IsPersonType FROM RecordType WHERE SobjectType='Account' AND IsPersonType=True


A) I don't know where to go from there (adding 'and email=joe@blow.com' throws an error)

B) if I used this method it would seem to be a two step process...there must be a more efficient 'select' statement to accomplish this in one step?



I have written a trigger to creates a record for a custom obj "Line_del__c" after a Lead is inserted. 


The only thing I can not get the Name of the Lead to pass over to "Line_del__c" Name field. It keeps passing an id like "a0OV000000078Mg"


Can not work it out!! Can anyone help please?


trigger InsertNewMonitorLine on Lead (after insert) {

    List<Lead> lam = new List<Lead>();
    for(Lead a: trigger.new){
        // insert a custom object 
        Line_del__c obj = new Line_del__c();
        obj.Name = a.Name;
        obj.Team_s_Dept_s_del__c = 'a0PV0000000EhlM';
        obj.ME1__c = '00530000004WakH';
        obj.Linked_NB__c = a.Id;
        obj.DTR3__c = System.Today();
        insert obj;
        insert lam;



I have a class in which I am updating a field for a custom object.For this class i have written a test class.In this test class i was creating new record for my custom object.


The problem is for this custom object,Name field is an Autonumber field.

So in my test class after inserting i was trying to send this Name to my Apex class.But surprisingly it is giving me NULL after insert in Test class.


Kindly let me know if this is a Salesforce defect.






I need to call Soap, from my apex class, to fetch data and show in my VF page. How should i go about it.

I have got this sample SOAP request/response code from my vendor. I need to use mes:subscriberId and mes:scheduleId to get Data.


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mes="http://XXXXX.net/ws/schemas/messages">


      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsse:UsernameToken wsu:Id="XWSSGID-1261544568770-474929336" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">


            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">###########</wsse:Password>






         <!--You may enter the following 4 items in any order-->









<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

   <SOAP-ENV:Header ver:CPIIDA-BUILD="build-30676" ver:CPIIDA-BUILD-TIME="03-01-2012 06:01" ver:CPIISRV-BUILD="build-30693" ver:CPIISRV-BUILD-TIME="03-01-2012 06:04" ver:CPIIWSRV-BUILD="build-30489" ver:CPIIWSRV-BUILD-TIME="03-01-2012 06:09" xmlns:ver="http://XXXXX.net/ws/schemas/header/version"/>


      <ns3:GetCheckImageResponse xmlns:ns3="http://XXXXX.net/ws/scmas/mages" xmlns:ns2="http://XXXXX.net/ws/schemas/types">






         <ns3:checkImageBack xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>


         <ns3:errorMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>







I am completely lost on how to do this, any kind of help will be appreciated.




I have a class that is used for converting a Lead. I need to write a test class for this but I can't seem to get it. Please help. Here's the class:


Public Class CustomLeadCont
string pr;
private final lead l;
public CustomLeadCont(ApexPages.StandardController stdController) {
this.l = (Lead)stdController.getRecord();
public PageReference autoRun() {

String theId = ApexPages.currentPage().getParameters().get('id');

if (theId == null) {
// Display the Visualforce page's content if no Id is passed over
return null;
for (Lead l:[select id, name, Checkbox_1__c, Checkbox_2__c from Lead where id =:theId])
If (l.Checkbox_1__c & l.Checkbox_2__c)
Database.LeadConvert lc = new database.LeadConvert();
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
Database.LeadConvertResult lcr = Database.convertLead(lc);
pr = lcr.getAccountId();
pr = l.id;}
PageReference pageRef = new PageReference('/' + pr);
return pageRef;




Here's the Test Class:


public class TestController{
static testMethod void TestControler()
Lead myLead = new Lead(LastName = 'Test', Company='Test Company', Checkbox_1__c = true, Checkbox_2__c=true);
insert myLead;
Apexpages.StandardController stdController = new Apexpages.StandardController(myLead);
CustomLeadCont cl= new CustomLeadCont(stdController);

  • January 05, 2012
  • Like
  • 0

I'm having a problem finding the right syntax for a pretty simple SOQL query.


So i have a basic query


Select Time_Clock__r.Team_Member_Employee__c FROM Time_Record__c where Id='xxxx'


which will return the Contact Id. Now I need to get the User associated with that contact. I've tried


SELECT Id from User where ContactId in (Select Time_Clock__r.Team_Member_Employee__c FROM Time_Record__c where Id='a0D3000000CiPAk')




SELECT Id from User where ContactId = (Select Time_Clock__r.Team_Member_Employee__c FROM Time_Record__c where Id='a0D3000000CiPAk')


I can't seem to find the correct syntax to achieve this. I'd appreciate any help.

Here is the Trigger


trigger AfterUpdateAssociatePeople on Associate__c (after update) {
Set<Id> assocIdSet = new Set<Id>();
Map<Id, Associate__c> assocMap = new Map<Id, Associate__c>();

List<Associate__c> assocList = [Select Id, Name, Current_Address__c, Current_City__c,Current_State__c,Current_Zip__c,from Associate__c where ID IN: assocIdSet];
for(Associate__c assoc: Trigger.new) {

    assocMap.put(assoc.Id, assoc);

List<People__c> peopleList =[Select Address_1__c,CID__c,Associate__c,City__c,State__c,Zip__c FROM People__c WHERE Associate__c IN: assocIdSet];
if(peopleList != null && peopleList.size() > 0) {
for(People__c people: peopleList) {
Associate__c assoc = assocMap.get(people.Associate__c);
people.Address_1__c = assoc.Current_Address__c;
people.City__c = assoc.Current_City__c;


update peopleList;


I wrote a Test Class and when i run the test it s not showing my trigger or its code coverage




private class AfterUpdateAssociatePeopleTest{
public static testMethod void AfterUpdateAssociatePeopleStaticTestMethod()

Associate__c aa =new Associate__c(Name='TestAss' ,Associate_ID__c='ASSID' ,First_Name__c='AssFName', Current_Address__c='TestAddress',Current_City__c='TestCity',Current_Zip__c='45678',Current_State__c='TX');
insert aa;

List<People__c> peopleList = new List<People__c>{new people__c(
Name='TestUser',Associate__c=aa.id,CID__c='ASSID',Address_1__c='3445street',City__c='',State__c='XX',Zip__c='75423', )};

insert peopleList;

List<People__c> peopleList1 = new List<People__c>{ [select id from People__c where id in :peopleList]};
for(People__c ppdd:peopleList1)
ppdd.Address_1__c = aa.Current_Address__c;

update peopleList1;










Below is the class and test class. It fine in UAT and gives  no errors but iam not able to deploy it into production as it gives error as  System.LimitException:Too many Query locator rows:10001


global class Visibility_Batch_BankAccount implements Database.Batchable<sObject> , Database.Stateful {
String query;
private Visibility_Utility vu;

global Database.QueryLocator start(Database.BatchableContext BC){
vu = new Visibility_Utility();

Visibility_Batch_Base vbb = new Visibility_Batch_Base('Bank_Account__c');
List<Integration_Info__c> intInfoList = [Select Last_Run_Time__c, Previous_Last_Run_Time__c from Integration_Info__c limit 1];
DateTime lastRunTime = intInfoList[0].Last_Run_Time__c;
DateTime PreviousLastRunTime = intInfoList[0].Previous_Last_Run_Time__c;

query = vbb.getQueryString();
return database.getQueryLocator(query);

global void execute(Database.BatchableContext BC, List<sObject> scope){

global void finish(Database.BatchableContext BC){



and the test class is


private class Visibility_Batch_BankAccount_Test{

static testMethod void Visibility_Batch_BankAccountTest(){
Visibility_Batch_BankAccount visBctBnkAcc = new Visibility_Batch_BankAccount();
Integration_Info__c ii = new Integration_Info__c();
ii.Previous_Last_Run_Time__c = System.Now().addMinutes(-1);
ii.Last_Run_Time__c = system.Now();
insert ii;

Bank_Account__c testBnkAcc = new Bank_Account__c(Name='testName');
List<Bank_Account__c> lstBnkAcc = new List<Bank_Account__c>();
insert lstBnkAcc;



I have two objects


Object 1


Object 2



Object 1 has a field "Field1"

Object 2 has a field "Field2"


Object 1 has  a field "CommonField" which is a lookup from Object2



Field2 is a formula  referring to a "Field3" in "Object 3"

Field1 is a picklist



When "CommonField" of Object1 is changed 


Field1 should have a value corresponding to the Field2 value



Any approach how to write the trigger for it



Finally got around to writing a blog post with 5 handy hints for those tackling the Advanced Developer Certification assignment — this doesn't cover the first exam, but aims to highlight a few things you should expect when doing the assignment and final exam.


Hope it's of use to some of you guys! 

Hey Guys,


For those new to the platform and eager to start cutting code, I've written a blog post explaining some of the pre-requisites, hope some folks find it useful.



As the subject states, is there a way to trigger territory assignment from apex? Have posted a question on stack overflow too for completeness, will cross-post the solution if there is one!



For an existing iPhone application which used old-school logins (i.e. required a token and stored user creds) I added OAuth support last week using code from the Mobile SDK preview.


It's been working perfectly until today, when I've had errors several times regarding failed JSON parsing when processing the response of a refresh request (see below). What's odd is that the JSON is perfectly valid according to jsonlint.com so I'm assuming there's a problem with the parsing that's happening in SFOAuthCoordinator. Anybody have any ideas of how to resolve this? It's preventing my from continuing with my development! (I know the SDK is a preview release but surely login shouldn't need to change?).


oauthCoordinator:didFailWithError: Error Domain=SFOAuthErrorDomain Code=668 "SFOAuthErrorDomain malformed_response : failed to parse response JSON" UserInfo=0x760d700 {error=malformed_response, NSLocalizedDescription=SFOAuthErrorDomain malformed_response : failed to parse response JSON, error_description=failed to parse response JSON, response_data={"id":"https://test.salesforce.com/id/00DO00000005SlNMAU/00590000000NZvLAAW","issued_at":"1320726727749","instance_url":"https://cs5.salesforce.com","signature":"bapfKpkvacGgWSEddD+buphb2W3Y2Rwaq40FBIrbERE=","access_token":"00DO00000005SlN!AR8AQLQofWLSElsO0xcyc4bnIdMe.vmoFz_Ua237NMtdEWO6KMgZW2rdNTEKsERFy3Df2Lxe1Cmh.QcWJ2jDHAtVaReXjDZI"}, NSUnderlyingError=0x760aa60 "SFOAuthErrorDomain malformed_response : failed to parse response JSON"}



Hi All,


Is it possible to upload images to a Rich text area field using Apex data loader ?





  • October 09, 2012
  • Like
  • 0


I am not able to Save and Deploy the application using Standalone Force.com IDE , it is giving me an error like

'Synchronized Check Failed'

Can you please guide how to resolve this error.



The user selected value not stored in object field value.myfield is a field of the customobject

Vf page:

<div class="options">
                                <apex:selectRadio value="{!custom.myfield}" required="true" layout="pageDirection">
                                <apex:selectOptions value="{!myOptions}" />



 public customobject__c custom{get; set;} 


Thanks in advance..


I have visualforce page which uses custom settings as select list and when I select few of the names then those needs to be displayed.

I have shown the select opions but I am not able to see the selected values in the output. (ie., after the message "You have chose"  I am not getting any output.




a) controller class

public class customsettingcontroller {

public string[] ISOSelected {get;set;}

    public PageReference test() {
        return null;

public list<SelectOption> getISOCodes() {
    List <SelectOption> listCodes = new List<SelectOption>();
    for (Country_Code__c cCode : Country_Code__c.getAll().values())     
      listCodes.add(new selectoption(cCode.ISO_Code__c, cCode.Name+'--'+cCode.ISO_Code__c));
        return listCodes;


b) visualforce page


<apex:page controller="customsettingcontroller">
 <apex:form >
  <apex:pageBlock title="Country Codes">
     <apex:selectList value="{!ISOSelected}" multiselect="true">
         <apex:selectOptions value="{!ISOCodes}"></apex:selectOptions>         
     <apex:actionSupport event="onselect" action="{!test}" rerender="output" status="status"/>     
 <apex:outputPanel id="output">
     <apex:actionStatus id="status" startText="testing...">
        <apex:facet name="stop">
          <apex:outputPanel >
          You have chose:
            <apex:dataList value="{!ISOSelected}" var="a">{!a}</apex:dataList>


Please help me on this.




  • April 18, 2012
  • Like
  • 0

I downloaded the latest version of the Mobile SDK today and ran ./install.sh but am getting build errors specifically with the json library.  The git commands seemed to work correctly and located all the libraries.  I have tried ./reset.sh and ./install.sh again with no change.  Here is the area that's failing:  (Note: all of the configurations for json lib fail the same way)








     [echo] artifacts.dir is '/Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/sfdc_build/artifacts'




     [echo] installing SBJson for SDK iphoneos
     [exec] Build settings from command line:
     [exec]     INSTALL_ROOT = /Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/sfdc_build/artifacts/SBJson
     [exec]     SDKROOT = iphoneos5.0
     [exec] Check dependencies
     [exec] SetOwnerAndGroup "chrisn5555:staff" /Users/chrisn5555/Documents/xcode-shared/UninstalledProducts/libsbjson-ios.a
     [exec]     cd /Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/json-framework
     [exec]     setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/Users/chrisn5555/Downloads/eclipse/plugins/org.jruby_1.2.0.9419p1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
     [exec]     /usr/sbin/chown -RH "chrisn5555:staff" /Users/chrisn5555/Documents/xcode-shared/UninstalledProducts/libsbjson-ios.a
     [exec] SetMode u+w,go-w,a+rX /Users/chrisn5555/Documents/xcode-shared/UninstalledProducts/libsbjson-ios.a
     [exec]     cd /Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/json-framework
     [exec]     setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/Users/chrisn5555/Downloads/eclipse/plugins/org.jruby_1.2.0.9419p1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
     [exec]     /bin/chmod -RH u+w,go-w,a+rX /Users/chrisn5555/Documents/xcode-shared/UninstalledProducts/libsbjson-ios.a
     [exec] ** BUILD SUCCEEDED **

/Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/shared/build.xml:214: The following error occurred while executing this line:
/Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/shared/build.xml:222: The following error occurred while executing this line:
/Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/sfdc_build/build.xml:40: The following error occurred while executing this line:
/Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/sfdc_build/build.xml:58: Warning: Could not find file /Users/chrisn5555/Documents/sf/SalesforceMobileSDK-iOS/external/json-framework/json-framework/build/UninstalledProducts/libsbjson-ios.a to copy.

I am getting  this error  System.QueryException: Non-selective query against large object type (more than 100000 rows).  only in production

Here is the query in my trigger.


list<Contact> con = new list<Contact>([Select c.Phone, c.EmpID__c, c.Id, c.Email From Contact c where c.EmpID__c!=null and c.EmpID__c =: trigger.new[0].ID__c limit 1])




Save error: Invalid bind expression type of SOBJECT:AggregateResult for Id field of SObject Contact



List<contact>  cnt = new List<Contact>([select id, name, from contact where contact.id =: [select max(id) from contact]]);

Dear Apex friends,


Is there anyway to get around the "too many callouts: 11" problem when I cannot bulkify my callouts?





I am facing this issue.Can anybody help me out?




Update error code CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: ReconcileOrder: execution of BeforeUpdate caused by: System.Exception: Apex heap size too large: 5218807




I like to execute my schedule (sche01), every 10 minutes;

how to plan it?







As the subject states, is there a way to trigger territory assignment from apex? Have posted a question on stack overflow too for completeness, will cross-post the solution if there is one!



In my component I use actionfunction and rerender

<apex:component controller="MultiSelectBoxController">
	<apex:panelGrid columns="4">
		<apex:actionFunction name="moveDown" action="{!moveDown}" reRender="selectedRight"/> 
	    <apex:selectList id="selectedRight" required="false" value="{!selectedRight}" multiselect="true" size="20" style="width:250px">
	        <apex:selectOptions value="{!rightOptions}"/> 
	    <apex:panelGroup layout="block" style="text-align: center; padding:10px;">
	        <a href="javascript&colon;moveUp();" style="text-decoration:none">
	            <img src="/s.gif" alt="Move Up" class="upArrowIcon" title="Move Up"/>


By debuging I am sure that my action method is called correctly


public class MultiSelectBoxController {

	public PageReference moveDown() {
		// For each selected item right
		for(Integer r=0; r<selectedRight.size(); r++) {
			// Iterate over right list
			for(Integer pos=rightOptions.size()-2; pos >=0; pos--) {
				// When select item is found 
				if(rightOptions[pos].getValue() == selectedRight[r]) {
					// Save item above
					SelectOption tmp = rightOptions[pos+1];
					// Switch options with item above
					rightOptions[pos+1] = rightOptions[pos];
					rightOptions[pos] = tmp;
		return null; 

 Even in Firebug I can see the AJAX POST request coming from the rerender. But on the page nothing happens although the rightOptions have changed...


After an hour of trial and error I hand this over to someone whos smarter than me....





We ran into an issue where SF can't store more than xxx chars and bytes in the formula. We have a huge lookup list which crucial part of our lead management system.. 


It's just a simple thing we need:

If County+State=ChicagoIL, then CountyID=6666

Else if County+State=NapervilleIL, then CountyID=7777



So We have this formula:


"BRISTOL BAYAK","12435",




which 3,000 lines long and somehow we need to implement this as an apex trigger(since SF can't handle big formulas).


What would be the best way to accomplosh this? Maybe someone has an example of how it should work as a apex trigger?


Any help is appreciated.