• rwc0001
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

How can I correctly determine the metadata endpoint URL for a given sessionId?

 

I have a program that is launched by a custom link I need to generate a metadata connection using the sessionId.

 

Currently I'm able to accomplish this by

1) guessing which pod (e.g. na1) the users on using the 'referer' header from a visualforce page that launched my app

2) manually constructing the metadata endpoint url from the pod and orgId 

 

The problem I'm running into in this approach is there are a lot of edge cases for what the referer url looks like, e.g. c.na1.visual.force.com or managedPackage.na1.visual.force.com.  Long term this strategy is less than ideal as it breaks whenever the url for visualforce pages changes.

 

Does anyone have any tips on how I can improve on this?

  • September 15, 2009
  • Like
  • 0

I'm able to create a new object tab through the metadata api, but I'm not having much luck updating the tab visibility.

 

When I try to update the tab visibility I'm getting an 'ENTITY_IS_DELETED' message.

 

The code looks good based on this post, but maybe I'm mising something?

 

ProfileTabVisibility tabVisibility = new ProfileTabVisibility(); tabVisibility.setTab(objectName); tabVisibility.setVisibility(TabVisibility.DefaultOn); String profileName = "Admin"; Profile userProfile = new Profile(); userProfile.setFullName(profileName); userProfile.setTabVisibilities(new ProfileTabVisibility[] { tabVisibility }); UpdateMetadata updateMetadata = new UpdateMetadata(); updateMetadata.setMetadata(userProfile); updateMetadata.setCurrentName(profileName); ars = metadataConnection.update(UpdateMetadata[] { updateMetadata });

 

Debugging snapshot of the updateMetadata array

 

[[UpdateMetadata currentName='Admin' metadata='[Profile [Metadata fullName='Admin' ] applicationVisibilities='{[0]}' classAccesses='{[0]}' fieldLevelSecurities='{[0]}' layoutAssignments='{[0]}' objectPermissions='{[0]}' pageAccesses='{[0]}' recordTypeVisibilities='{[0]}' tabVisibilities='{[1][ProfileTabVisibility tab='last_try__c' visibility='DefaultOn' ] ,}' ] ' ] ]

 Debuggig snapshot of status check

 

[[AsyncResult checkOnly='false' done='true' id='04s30000000HcHkAAK' message='entity is deleted' numberComponentErrors='0' numberComponentsDeployed='0' numberComponentsTotal='0' numberTestErrors='0' numberTestsCompleted='0' numberTestsTotal='0' secondsToWait='0' state='Error' stateDetail='null' stateDetailLastModifiedDate='null' statusCode='ENTITY_IS_DELETED' ] ]

 

 

 

 

 

 

 

  • September 10, 2009
  • Like
  • 0

How can I correctly determine the metadata endpoint URL for a given sessionId?

 

I have a program that is launched by a custom link I need to generate a metadata connection using the sessionId.

 

Currently I'm able to accomplish this by

1) guessing which pod (e.g. na1) the users on using the 'referer' header from a visualforce page that launched my app

2) manually constructing the metadata endpoint url from the pod and orgId 

 

The problem I'm running into in this approach is there are a lot of edge cases for what the referer url looks like, e.g. c.na1.visual.force.com or managedPackage.na1.visual.force.com.  Long term this strategy is less than ideal as it breaks whenever the url for visualforce pages changes.

 

Does anyone have any tips on how I can improve on this?

  • September 15, 2009
  • Like
  • 0

I'm able to create a new object tab through the metadata api, but I'm not having much luck updating the tab visibility.

 

When I try to update the tab visibility I'm getting an 'ENTITY_IS_DELETED' message.

 

The code looks good based on this post, but maybe I'm mising something?

 

ProfileTabVisibility tabVisibility = new ProfileTabVisibility(); tabVisibility.setTab(objectName); tabVisibility.setVisibility(TabVisibility.DefaultOn); String profileName = "Admin"; Profile userProfile = new Profile(); userProfile.setFullName(profileName); userProfile.setTabVisibilities(new ProfileTabVisibility[] { tabVisibility }); UpdateMetadata updateMetadata = new UpdateMetadata(); updateMetadata.setMetadata(userProfile); updateMetadata.setCurrentName(profileName); ars = metadataConnection.update(UpdateMetadata[] { updateMetadata });

 

Debugging snapshot of the updateMetadata array

 

[[UpdateMetadata currentName='Admin' metadata='[Profile [Metadata fullName='Admin' ] applicationVisibilities='{[0]}' classAccesses='{[0]}' fieldLevelSecurities='{[0]}' layoutAssignments='{[0]}' objectPermissions='{[0]}' pageAccesses='{[0]}' recordTypeVisibilities='{[0]}' tabVisibilities='{[1][ProfileTabVisibility tab='last_try__c' visibility='DefaultOn' ] ,}' ] ' ] ]

 Debuggig snapshot of status check

 

[[AsyncResult checkOnly='false' done='true' id='04s30000000HcHkAAK' message='entity is deleted' numberComponentErrors='0' numberComponentsDeployed='0' numberComponentsTotal='0' numberTestErrors='0' numberTestsCompleted='0' numberTestsTotal='0' secondsToWait='0' state='Error' stateDetail='null' stateDetailLastModifiedDate='null' statusCode='ENTITY_IS_DELETED' ] ]

 

 

 

 

 

 

 

  • September 10, 2009
  • Like
  • 0