You need to sign in to do that
Don't have an account?
k practice
How to avoid readonly fields in below code?
Hi,
for(Schema.SObjectField objField : Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap().values())
{
if(objField.getDescribe().getName().endsWith('__pc'))
{
String str=objField.getDescribe().getName();
String personaccountFields=str.replaceAll('__pc', '__c');
Ocontact.put(str, personaccountFields.get(str));
}
}
here i was getting readonly fields error .how to solve this error?
for(Schema.SObjectField objField : Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap().values())
{
if(objField.getDescribe().getName().endsWith('__pc'))
{
String str=objField.getDescribe().getName();
String personaccountFields=str.replaceAll('__pc', '__c');
Ocontact.put(str, personaccountFields.get(str));
}
}
here i was getting readonly fields error .how to solve this error?
Here i was getting Contact object Custom fields.If suppose one custom field is not there in below comparing object(Person object).How to avoid this custom fields and same fields how to update?
for (Schema.SObjectField objField: Schema.getGlobalDescribe().get('Contact').getDescribe().fields.getMap().values()) {
DescribeFieldResult fr = objField.getDescribe();
if (fr.isUpdateable()) //isCreateable())
{
if (fr.getName().endsWith('__c')) {
String str = fr.getName();
String contactcustomFields = str.replaceAll('__c', '__pc');
System.debug(contactcustomFields);
pAccount.put(contactcustomFields, Ocontact.get(str));
//update pAccount;
System.debug(pAccount.put(contactcustomFields, Ocontact.get(str)));
}
}
}
Help me.....