+ Start a Discussion
Rajesh SFDCRajesh SFDC 

Method does not exist or incorrect signature: [String].iscreatable()

public class checksobjectprofiles
{

public List<SelectOption> ListOfUser {public get; private set; }

public String selecteduserId { get; set; }

public string searchresult;
public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
public List <SelectOption> objectNames{public get; private set;}
public String selectedObject {get; set;}


public checksobjectprofiles ()
{
objectNames = initObjNames();
ListOfUser= initListOfUser();


}
private List<SelectOption> initObjNames()
{
List<SelectOption> objNames = new List<SelectOption>();
List<String> entities = new List<String>(schemaMap.keySet());
entities.sort();
objNames.add(new SelectOption( ' ' ,'---Select---'));
for(String name : entities)
{


objNames.add(new SelectOption(name,name));
}
return objNames;
}

private List<SelectOption> initListOfUser()
{
// String uid = UserInfo.getUserId();
List<User> thisUser = [select id, Username, profile.name from User where IsActive=true];
List<SelectOption> Ulist = new List<SelectOption>();
Ulist.add(new SelectOption( ' ' ,'---Select---'));
for(User u : thisuser )
{

Ulist.add(new SelectOption(u.Username ,u.username));
}
return Ulist ;
}

public void checkFields()
{

//fields.clear();
system.debug('$$$$$' + selectedObject);
list<string> lstFields = new list<string>();

list<string> sobjectfields = new list<string>();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get(selectedObject).getDescribe().fields.getMap();
for(Schema.SObjectField sfield : fieldMap.Values())
{
schema.describefieldresult fieldresult = sfield.getDescribe();

lstFields.add(fieldresult.getName());
// system.debug('#######' + lstFields );
}

// system.debug('@@@@@@@@@@@@@@@@@@@'+selectedObject);

Map<String,Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.DescribeSObjectResult r = gd.get(selectedObject).getDescribe();
String tempName = r.getName();
system.debug('*************'+tempname);
system.debug('selecteduserid'+selecteduserId);
system.debug('%%%%%%%%%%%%%%'+lstFields);

searchresult= 'select' + lstFields +'from' + 'tempName' + ' WHERE ' + ' Id =: selecteduserId ';
system.debug('*************'+searchresult);
System.runAs(searchresult)
{

if(searchresult.isUpdatable()) here i am getting error
{
// updatecheckbox=true;
}
if(searchresult.isdeletable()) here i am getting error
{
// updatecheckbox=true;
}
}

please help me frds.
}



}

Vinita_SFDCVinita_SFDC

Hello,

 

Is this complete code. As i don't see anywhere you are calling method isCreatable. The error says you are calling a method whose signature is not matching with the method.

 

Also in this code isCreatable method is not defined.

 

Please share complete code.

k practicek practice
Hi,
       I try to get only Editable fields but it's not working please help me....

for(Schema.SObjectField objField : Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap().values())
                     {
                         
                         DescribeFieldResult fr = objField.getDescribe();
                           if (fr.isCreatable())
                           {
                              if(fr.getName().endsWith('__pc'))
                              {  
                           String str=fr.getName();
                           String personaccountFields=str.replaceAll('__pc','__c');
                           System.debug(personaccountFields);
                           Ocontact.put(personaccountFields, Personaccount.get(str));
                           System.debug(Ocontact.put(personaccountFields, Personaccount.get(str)));
                              }
                       }
                     }