I have a set of fields in the array list which I wanted to give FLS with Read access. I'm using below piece of code to update the field level security using Salesforce API in java language.
But the problem is that for each field it is taking 4 to 5 seconds to update the FLS. Is there any way that we can have all the changes in the list and update the FLS in bulk.
I tried adding admins in the List but it doesn't help.
for(String field:updateReadList) {
ProfileFieldLevelSecurity fieldSec = new ProfileFieldLevelSecurity();
fieldSec.setField(field);
fieldSec.setReadable(true);
fieldSec.setEditable(false);
admin.setFieldPermissions(new ProfileFieldLevelSecurity[] { fieldSec });
api.updateMetadata(new Metadata[] {admin});
System.out.println("Success");
}