• Matthew Birckbichler
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hey guys, I made a VF page with a Controller Extension.
public class createOpportunityContactExtension {
    public final Opportunity_Contact__c oppCon;
    
    public createOpportunityContactExtension(ApexPages.StandardController stdController){
        this.oppCon = (Opportunity_Contact__c)stdController.getRecord();
        oppCon.Opportunity__c = apexpages.currentpage().getparameters().get('oppId');
    }
    
    public static Boolean lookup = true;
    public static Boolean pickList = false;
    
    public static void toggleContact(){
        IF(oppCon.Account__c != null){
            createOpportunityContactExtension.lookup = false;
            createOpportunityContactExtension.pickList = true;
        }
    }  
      
    public Boolean viewLookup{get{return lookup;}}
    public Boolean viewPickList{get{return pickList;}}
    
}
I cannot seem to figure out how to access the current Opportunity_Contact__c (oppCon), to check if the Account__c field is null
public static void toggleContact(){
        IF(oppCon.Account__c != null){
            createOpportunityContactExtension.lookup = false;
            createOpportunityContactExtension.pickList = true;
        }
    }
I will start of by saying, I am pretty familiar with APEX, but brand new toVisualForce.
I have a custom objects called Opportunity_Contact__c, in the related list for this on Opportunity, I need to replace the current 'new' Button with a custom button to a VF page.
First issue I am having is, if I use the standard controller 'Opportunity_Contact__c', when I click the button, I recieve this...
'Id value 00655000004MBYc is not valid for the Opportunity_Contact__c standard controller'.
I realize that this is because it is passing the Opportunity ID into the VP page, and I am not using the Opportunity standard controller, but I am unsure how to move forward.

My code thus far :
<apex:page standardController="Opportunity_Contact__c" extensions="createOpportunityContactExtension">
<apex:form >
<apex:pageBlock title="Create New Opportunity Contact" mode="new">

    <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
    </apex:pageBlockButtons>
    
    <apex:pageBlockSection columns="1">
        <apex:inputField value="{!Opportunity_Contact__c.Opportunity__c}"/>
    </apex:pageBlockSection>
    
</apex:pageBlock>
</apex:form>
</apex:page>
public class createOpportunityContactExtension {
    private final Opportunity_Contact__c oppCon;    
    public createOpportunityContactExtension(ApexPages.StandardController stdController){
        this.oppCon = (Opportunity_Contact__c)stdController.getRecord();
    }
       
}


 
I want to create a visual force page that has dependent picklists to show all fields and related objects fields. Basically I want it to function exactly like the 'insert field' button in a formula builder or process builder. The end goal is to just be able to navigate through an objects fields/related fields and copy the api name of the selected field. Can anybody help me with code for this, and if you have the time please explain a little bit. Thanks
I know im missing something simple but cannot figure out what,
I am trying to have the user select an sObject from a list and getting an error when trying to save VF -- Unknown property 'CustomPdfController.allObjectsList'

VF Code:
<apex:page controller="CustomPdfController" >
    <apex:form>
        <apex:pageblock>
            <apex:outputLabel value="Choose Object: "></apex:outputLabel>
            <apex:selectList value="{!allObjectsList}"></apex:selectList>
        </apex:pageblock>
    </apex:form>
</apex:page>


APEX Code:
public with sharing class CustomPdfController {
    public list<SelectOption> allObjectsList(){
        list<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
        list<SelectOption> options = new list<SelectOption>();
        options.add(new SelectOption('','--SELECT--'));
        for(Schema.SObjectType gd1:gd){
            options.add(new SelectOption(gd1.getDescribe().getName(),gd1.getDescribe().getName()));
        }
        options.sort();
        return options;
    }
}
I downloaded a command-line toolkit to my desktop to that has the capability to edit pdfs, which is something I need to do within salesforce. I was thinking that I either need to set up a server (which I know nothing about), or utilize the local machine command line somehow. Any thoughts on this? or am I on the wrong path?
I will start of by saying, I am pretty familiar with APEX, but brand new toVisualForce.
I have a custom objects called Opportunity_Contact__c, in the related list for this on Opportunity, I need to replace the current 'new' Button with a custom button to a VF page.
First issue I am having is, if I use the standard controller 'Opportunity_Contact__c', when I click the button, I recieve this...
'Id value 00655000004MBYc is not valid for the Opportunity_Contact__c standard controller'.
I realize that this is because it is passing the Opportunity ID into the VP page, and I am not using the Opportunity standard controller, but I am unsure how to move forward.

My code thus far :
<apex:page standardController="Opportunity_Contact__c" extensions="createOpportunityContactExtension">
<apex:form >
<apex:pageBlock title="Create New Opportunity Contact" mode="new">

    <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
    </apex:pageBlockButtons>
    
    <apex:pageBlockSection columns="1">
        <apex:inputField value="{!Opportunity_Contact__c.Opportunity__c}"/>
    </apex:pageBlockSection>
    
</apex:pageBlock>
</apex:form>
</apex:page>
public class createOpportunityContactExtension {
    private final Opportunity_Contact__c oppCon;    
    public createOpportunityContactExtension(ApexPages.StandardController stdController){
        this.oppCon = (Opportunity_Contact__c)stdController.getRecord();
    }
       
}


 
I know im missing something simple but cannot figure out what,
I am trying to have the user select an sObject from a list and getting an error when trying to save VF -- Unknown property 'CustomPdfController.allObjectsList'

VF Code:
<apex:page controller="CustomPdfController" >
    <apex:form>
        <apex:pageblock>
            <apex:outputLabel value="Choose Object: "></apex:outputLabel>
            <apex:selectList value="{!allObjectsList}"></apex:selectList>
        </apex:pageblock>
    </apex:form>
</apex:page>


APEX Code:
public with sharing class CustomPdfController {
    public list<SelectOption> allObjectsList(){
        list<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
        list<SelectOption> options = new list<SelectOption>();
        options.add(new SelectOption('','--SELECT--'));
        for(Schema.SObjectType gd1:gd){
            options.add(new SelectOption(gd1.getDescribe().getName(),gd1.getDescribe().getName()));
        }
        options.sort();
        return options;
    }
}
I downloaded a command-line toolkit to my desktop to that has the capability to edit pdfs, which is something I need to do within salesforce. I was thinking that I either need to set up a server (which I know nothing about), or utilize the local machine command line somehow. Any thoughts on this? or am I on the wrong path?