Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:37:28+00:00 2026-06-04T23:37:28+00:00

I know how to return a PageReference to edit and view a sObject: PageReference

  • 0

I know how to return a PageReference to edit and view a sObject:

PageReference ref =  new ApexPages.StandardController(bnk).edit();

But the StandardController class hasn’t any method like create.

How can I return the page to create the sObject.

I alse know the methed like:

PageReference ref =  new PageReference('/a00/e');

but the sObject has many lookup fields.This method can’t take out the reference lookup fields.It only can create a standalone sObject.

So how to return the create page and also take out the reference lookup fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:37:30+00:00Added an answer on June 4, 2026 at 11:37 pm

    I had the same problem when trying to add a Save and New button. It seems odd that the StandardController doesn’t have a new() method that returns a PageReference.

    If your Apex class is going to be deployed to another Salesforce org (E.g. added to an outbound change set, put in a managed or unmanaged package, or deployed using Eclipse) I’d avoid hard coding the custom objects key prefix as this could change between orgs. Instead, use the DescribeSObjectResult to get the KeyPrefix.

    public PageReference customObjectPageReference() {
        Schema.DescribeSObjectResult R = YourCustomObject__c.SObjectType.getDescribe();
        // Add /o to end of URL to view recent
        return new PageReference('/' + R.getKeyPrefix() + '/e');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can return a javascript view but this has never worked for
I am a new in objective-c, I want to know when I return an
I know that a command line application should return 0 on success. But are
I know I can use window.location.pathname to return a url, but how do I
i want create date validation but not know why return is false? $data_go =
I have the following function that I know should return TRUE but it will
Hi i wanted to make registration form. but i don't know how to return
I know indexOfObject could return the index of the element in an array, but
Does any Common Lisp (builtin) function return more than 2 values? I know many
I know that I can return the index of a particular character of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.