• test test 5030
  • NEWBIE
  • 0 Points
  • Member since 2016

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

We are created a apex code to update view with visualforce page in managed package. We are calling apex code as a post install script in the managed package and below is the code.

global class PostInstallClass implements InstallHandler {
global void onInstall(InstallContext context) {
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId(); 
MetadataService.ActionOverride actionOverrides1 = new MetadataService.ActionOverride();
actionOverrides1.actionName = 'View';
actionOverrides1.type_x  = 'Visualforce';
actionOverrides1.content = 'VFAPIPage';
actionOverrides1.comment = 'Configure Visual Force page with Opportunity.';
MetadataService.CustomObject customObject = new MetadataService.CustomObject();
customObject.fullName = 'Opportunity'; 
customObject.actionOverrides = new MetadataService.ActionOverride[] { actionOverrides1 };
service.updateMetadata( new MetadataService.Metadata[] { customObject });
}
}

The packaging is not installaling and giving post install error message and below is the error message.

Message : You have uncommitted work pending. Please commit or rollback before calling outLine no : 10822 getStackTraceString Class.recoapi.MetadataService.MetadataPort.updateMetadata: line 10822, column 1 Class.recoapi.PostInstallClass.UpdateView: line 21, column 1 Class.recoapi.PostInstallClass.onInstall: line 3, column 1null

The apex code is working fine in my organization but its not woking in destion instance while installing managed package with post install script.

Please share possible options with us, to change opportunity view with visualforce page using apex code.
Hello,

We are creating a custom button (to trigger an event) in SFDC’s Opportunity page for all existing Opportunities.
The button was created in a developer SFDC instance and uploaded as part of a managed package.
 
Challenge:
The custom button is displaying only for newly created records, which are created after app installation and not displaying Older(existing) Opportunity records.
We need to display custom button for all opportunities after installation of app in new SFDC environment.
 
Please share possible options with us, to display custom button in all opportunities after installing app into new SFDC environment.
 
Thanks,
Pavan N
 
Hello,

We are creating a custom button (to trigger an event) in SFDC’s Opportunity page for all existing Opportunities.
The button was created in a developer SFDC instance and uploaded as part of a managed package.
 
Challenge:
The custom button is displaying only for newly created records, which are created after app installation and not displaying Older(existing) Opportunity records.
We need to display custom button for all opportunities after installation of app in new SFDC environment.
 
Please share possible options with us, to display custom button in all opportunities after installing app into new SFDC environment.
 
Thanks,
Pavan N