• Akram Gargouri
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
How to implement the dependent behavior of this new feature (i.e. enabling Country and State picklist in Org). On standard contact page it shows depent behavior automatically but when we bind these field with in VF page the dependent behavior is lost

Is there a simple way to implement this behavior in VF page

Any help would be appreciated
 

Hi Guys,

I am trying to merge two contacts. Class is using the keyword  "without sharing". So the the class is running in system admin mode. I have checked the system admin profie, the profile is having all permissions(DELETE contact, MODIFY ALL DATA on contact).

I am calling this class on another class , that parent class is also using the keyword "without sharing". But still I am getting below error:
Merge failed. First exception on row 0 with id 0031100000XXYfRAAX; first error: INSUFFICIENT_ACCESS_OR_READONLY, cannot merge with entity that is not accessible: []

Below is class code:

public without sharing class DeleteContact {
    public void deleteContact(String contactId,string email){
        Map<String, Schema.SobjectField> contactfields = Schema.SObjectType.contact.fields.getMap();
        List<Schema.SObjectField> fldObjMapValues = contactfields.values();
        string theQuery1;
        string theQuery2;
        String theQuery = 'SELECT ';
            for(Schema.SObjectField s : fldObjMapValues)
            {
               String theLabel = s.getDescribe().getLabel();
               String theName = s.getDescribe().getName();
               theQuery += theName + ',';
            }
            theQuery = theQuery.subString(0, theQuery.length() - 1);
          
            theQuery1 = theQuery + ' FROM Contact WHERE Id =: contactId';
            theQuery2 = theQuery + ' FROM Contact WHERE Id !=: contactId AND Email =: email';
          
      
        Contact previouscontact=Database.query(theQuery1);
        List<Contact> listContacts=Database.query(theQuery2);
        if(previouscontact!=null && listContacts[0]!=null){
            try{
                merge  previouscontact listContacts[0];
            }
            catch(Exception e){
                system.debug('============='+e.getMessage());
            }
    }
}


Can some one please suggest me why this error is coming?. Urgent Please.