function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chetna AgrawalChetna Agrawal 

Check Update permissions on object instance/record

We can use Schema.sObjectType.Contact.isUpdatable() to check if the current user has permissions to update Contact objects in general.

I want this for dynamic object.my object name is within the objName string variable.
Best Answer chosen by Chetna Agrawal
Alexander TsitsuraAlexander Tsitsura

Hi Chenta

Try this
 
String objName = 'Account';
Boolean isUpdateableAccount = Schema.getGlobalDescribe().get(objName).getDescribe().isUpdateable();


As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex

All Answers

Alexander TsitsuraAlexander Tsitsura

Hi Chenta

Try this
 
String objName = 'Account';
Boolean isUpdateableAccount = Schema.getGlobalDescribe().get(objName).getDescribe().isUpdateable();


As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex
This was selected as the best answer
AvinashBAvinashB
Hello Chetna, 

you can use below code to pass the object name in string.

String customObjectName = 'CustomObjectName__c';
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.SObjectType s = gd.get(customObjectName);
Schema.DescribeSObjectResult r = s.getDescribe();
system.debug('***********'+r.isUpdateable());

Thanks,
Avi