Alright, I finished the extension and it works. Thanks to Jason Hardy for suggesting the extension! Here it is:
public class CreateAdditionalPayeeExtension {
Payee__c payee {get;set;}
//constructor
public CreateAdditionalPayeeExtension(ApexPages.StandardController stdController){
payee = (Payee__c)stdController.getRecord();
payee.Order__c = ApexPages.currentPage().getParameters().get('ordId');
}
public PageReference save(){
insert payee;
return null;
}
}
(You can ignore the save function in the extension; I'm just trying to now make a save button that overrides the standard one on my VF page so that it can redirect to a specific page.) So after I made this, I used it to auto-fill the "Order" lookup field on the VF page (I decided to leave the rest blank). Here's the VF page:
<apex:page standardController="Payee__c" extensions="CreateAdditionalPayeeExtension">
<apex:form >
<apex:pageBlock title="Add Additional Payee Information" mode="save">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Additional Payee" columns="1">
<apex:inputField value="{!Payee__c.Order__c}"/>
<apex:inputField value="{!Payee__c.Payee_Type__c}"/>
<apex:inputField value="{!Payee__c.Agency__c}"/>
<apex:inputField value="{!Payee__c.Agent__c}"/>
<apex:inputField value="{!Payee__c.Additional_Agency_Rate__c}"/>
<apex:inputField value="{!Payee__c.Rate_Based_On__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
So, as you can see, nothing changed on the VF page from before besides the extension at the top, BUT along with the button URL that is on the Order object that links to the page (/apex/Create_Additional_Payee?ordId={!Order.Id}), the extension works to override the
<apex:inputField value="{!Payee__c.Order__c}"/>
line and when the button is clicked on the Order object, the lookup field is successfully pre-populated, but still able to be changed to something else if the user so desires.
Sorry for the long and convoluted explanation, but that's pretty much the order in which I figured it out so I don't know a better way to explain it. I hope this helps anyone that has the same problem!
Best Answer
Update
We can now query those
01I
object ids and00N
field ids directly without Tooling API or callouts.This will return:
Much easier than the historical solution - and no Session ID involved or API privilege issues.