0

I have installed Salesforce CPQ managed package in my org and there is object called 'Contract' which has Renew Contract button in it.

I want to use that button in my custom Visualforce page so as to use the same functionality of Renew Contract

enter image description here

VF page

<apex:page Controller="Contract">
<apex:form >
    <apex:pageBlock title="Renew Contracts">
        <apex:commandButton value="Renew Contracts" action="{!RenewContracts}"/>
    </apex:pageBlock>    
</apex:form>

Controller

public with sharing class Contract {

public PageReference RenewContracts() {
    pageReference p = new pageReference('/apex/RenewContracts');
    p.setRedirect(true);
    return p; 

}
}

But it is showing Page RenewContracts does not exist

  1. Can't we use Standard controller and call RenewContracts from our custom VF page??

  2. Can't we use the methods,VF pages of managed package app (which is defined Global in our Managed Packaged) in our Custom codes,Custom VF pages.

3

We cannot use Apex code from Manages packages (excluding global classes), however, it is possible to use VF pages.

Your code in controller is almost right, but you need to add CPQ package namespace in URL:

PageReference p = new pageReference('/apex/{{CPQ_PACKAGE_NAMESPACE}}__RenewContracts');
| improve this answer | |
  • It's showing "This site can’t be reached"..!! – vd123 Feb 25 at 9:20
  • Do I need to replace {{CPQ_PACKAGE_NAMESPACE}}__ with something?? – vd123 Feb 25 at 9:22
  • 2
    Yes - with the actual CPQ package namespace value. You can find this out by going to setup on the org, finding the Visualforce Pages (using Quick Find in the left-hand navigation area) and looking for the page in the list. It will have a value in the "Namespace Prefix" column that you use to replace this placeholder with. – Phil W Feb 25 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.