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

Can't update manage package Page Layout #32

Closed
kbabintsev opened this issue Jun 17, 2014 · 9 comments
Closed

Can't update manage package Page Layout #32

kbabintsev opened this issue Jun 17, 2014 · 9 comments

Comments

@kbabintsev
Copy link

Hi. I'm trying to update Layout:

    MetadataService.MetadataPort service = new MetadataService.MetadataPort();
    service.SessionHeader = new MetadataService.SessionHeader_element();
    service.SessionHeader.sessionId = sessionId;
    service.endpoint_x = endpoint;

    MetadataService.Layout layout = 
        (MetadataService.Layout)service.readMetadata('Layout', 
            new String[] { 'CaAwsCloudTrailEvent__c-AWS CloudTrail Event Layout' }).getRecords()[0];

    System.debug(layout.fullName);

    handleSaveResults(
        service.updateMetadata(
            new MetadataService.Metadata[] { layout })[0]);        

    System.debug('DONE');

but getting error "Required field is missing: fullName", because retrieved field fullName is null. It is possible update MP page layout through metadata api? Thank you.

@afawcett
Copy link
Contributor

Yes it is possible to do this https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataServiceExamples.cls#L696. What i have noticed is that for some reason if you get the layout name wrong it returns a blank layout. So double check your layout name via listMetadata or using the Salesforce Developer Workbench tool which also has a means to list metadata.

@kbabintsev
Copy link
Author

Yes, name was wrong. Valid name is 'CA10__CaAwsCloudTrailEvent__c-AWS CloudTrail Event Layout' (CA10 is our namespace). But I get the same error. I tried to do this with Java API v29 (http://www.salesforce.com/us/developer/docs/api_meta/), but I got the same result. Everything works well with dev org (where name is 'CaAwsCloudTrailEvent__c-AWS CloudTrail Event Layout').

@afawcett
Copy link
Contributor

I see so it works if you try to edit a unmanaged layout, but if you try to edit a managed package installed layout it fails? Is CA10 your managed package namespace?

@kbabintsev
Copy link
Author

Yes, that's right. Yes, "CA10" is our namespace.

@afawcett
Copy link
Contributor

I'm wondering if this is restriction of the Metadata API, have you tried API v30.0?

@kbabintsev
Copy link
Author

v29 is latest version available in maven central http://mvnrepository.com/artifact/com.force.api/force-metadata-api

@kbabintsev
Copy link
Author

I solved this. It works if I try 'CA10__CaAwsCloudTrailEvent__c-CA10__AWS CloudTrail Event Layout'. btw listMetadata returns 'CA10__CaAwsCloudTrailEvent__c-AWS CloudTrail Event Layout' (without prefix).

@afawcett
Copy link
Contributor

Wow that is inconsistant, glad you sorted it! Enjoy the API now! 👍

@adam84luong
Copy link

Thanks kbabintsev, your solution worked even in v39.

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

3 participants