Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata API : Clone Profile settings (changing full name and license) : System.CalloutException: IO Exception: Read timed out #259

Open
SouthSuppttar opened this issue May 8, 2020 · 0 comments

Comments

@SouthSuppttar
Copy link

  • I was trying to sync two profiles settings with Metadata API
  1. Fetch profile using readMetadata method
  2. Update fullname and userLicense and call updateMetadata method

I am getting System.CalloutException: IO Exception: Read timed out error

I have tried updating tabVisibility with an above approach for the same profile and it works as expected.

tabVisibility update code (SUCCESS)

public void updateTabVisibilityProfile() {
        createSession();
        MetadataService.Profile communityProfile = (MetadataService.Profile) service.readMetadata('Profile', new String[] { 'Profile1' }).getRecords()[0];

        for(MetadataService.ProfileTabVisibility tabVisibility : communityProfile.tabVisibilities){
            tabVisibility.visibility = 'Hidden';
        }
        
        List<MetadataService.SaveResult> results = service.updateMetadata(new MetadataService.Metadata[] { communityProfile });
        handleSaveResults(results[0]);
    } 

Cloning whole profile (ERROR - Read Timeout)

public void syncProfile() {
        createSession();

        MetadataService.Profile sourceProfile = (MetadataService.Profile) service.readMetadata('Profile', new String[] { 'Community User - Participant' }).getRecords()[0];
        System.debug('sourceProfile >>'+sourceProfile.fullName);
        
        sourceProfile.fullName = 'Profile2Name';
        sourceProfile.userLicense = 'License2';
        
        List<MetadataService.SaveResult> results = service.updateMetadata(new MetadataService.Metadata[] { sourceProfile });
        handleSaveResults(results[0]);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant