function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ToddKruseToddKruse 

Redirecting to a different page when a custom object is created

Currently in our system, a user adds Assignments to a project.  They do this by going into the project and clicking the "New Assignment" button which takes them to a new screen where they enter in the required information.  When they click the save button, the required record(s) are created in the system and redirects the page to a different location showing them the records they created.

 

What they would like to have happen is, once the user clicks the save button on the Assignment screen, to redirect the user back to the Projects screen.

 

Is this possible?

 

Thanks

 

--Todd Kruse

 

 

Best Answer chosen by Admin (Salesforce Developers) 
CaptainObviousCaptainObvious

Usually I'd achieve this via a custom visualforce page, but see this works for you...

 

Step 1 - Prepare the custom URL

 

Go to the Project page and click the "New Assignment" button on the related list.

Copy the URL at the top of the page. For example, you may see something like

https://www.salesforce.com/a0q/e?CF00N40000001zNyc=TestProject&CF00N40000001zNyc_lkid=a0pS00000009cbY&retURL=%2Fa0pS00000009cbY

Discard everything before the first single '/' forward slash so you end up with

 

/a0q/e?CF00N40000001zNyc=Test%20Project&CF00N40000001zNyc_lkid=a0pS00000009cbY&retURL=%2Fa0pS00000009cbY

You may or may not see the highlighted parameters- you may even see additional parameters.
In this example, the Project lookup field on the New Assignment is prepopulated with the name and Id of the Project.

Replace the field values with merge fields, and add an additional saveURL parameter

 

/a0q/e?CF00N40000001zNyc={!Project__c.Name}&CF00N40000001zNyc_lkid={!Project__c.Id}&retURL=%2F{!Project__c.Id}&saveURL=%2F{!Project__c.Id}

 

Step 2 - Create the custom button

 

Go to the Assignment object and create a new custom button

Set the options as follows:
Label - New Assignment
Display Type - List Button (uncheck the 'Display Checkboxes...' box)
Behavior - Display in existing window without sidebar or header
Content Source - URL

In the content area, paste the url you created

Click Save 


Step 3 - Add the Custom button to the related list

 

Go to your Project page layout
Scroll down to the Assignments related list and click the wrench to open the related list properties
Click the '+' in the Buttons section to expand the options
Deselect the standard New button
Select the New Assignment button from the Available Buttons and add it to the Selected Buttons
Click OK
Save the page layout


Good Luck!

All Answers

NasipuriNasipuri

Hi Todd,

 

For this you need to Use a New custom "New Assignment" button , or If your user is using the New Assignment functionality from the related list only you can override the standard "New Assignment" button.

 

Can be done by an S-Conrtol or VF page , I will suggest use a VF page and return the pagereference of the Project Record View action.

 

Thanks,

Dinesh Nasipuri

Dinesh.NAsipuri@gmail.com

 

ToddKruseToddKruse

Thanks for the reply.  But I am still not clear on how to code an S-Control to both save the new record AND redirect it back to a different screen.  At this time, we really can't use a VF page.  We are just using the SF page that we set up using a page layout.  The user enters information and we just want the save to insert the record and then redirect them back to a different page. 

 

 

Sorry if this is something simple I am just not seeing, but any help in this matter would be greatly appreciated.

 

Thanks

 

--Todd Kruse 

ToddKruseToddKruse

I was looking at my current screen.  The user creates "Assignments"  When they click the "edit" link, it brings up the Assignment window where they can make changes if needed.  When they click save, it closes the screen and brings them back to the page where they clicked the "edit" button.  What I would need to do is cause the same redirect back to the calling page when they click the "new assignment" button.

 

--Todd Kruse 

CaptainObviousCaptainObvious

Usually I'd achieve this via a custom visualforce page, but see this works for you...

 

Step 1 - Prepare the custom URL

 

Go to the Project page and click the "New Assignment" button on the related list.

Copy the URL at the top of the page. For example, you may see something like

https://www.salesforce.com/a0q/e?CF00N40000001zNyc=TestProject&CF00N40000001zNyc_lkid=a0pS00000009cbY&retURL=%2Fa0pS00000009cbY

Discard everything before the first single '/' forward slash so you end up with

 

/a0q/e?CF00N40000001zNyc=Test%20Project&CF00N40000001zNyc_lkid=a0pS00000009cbY&retURL=%2Fa0pS00000009cbY

You may or may not see the highlighted parameters- you may even see additional parameters.
In this example, the Project lookup field on the New Assignment is prepopulated with the name and Id of the Project.

Replace the field values with merge fields, and add an additional saveURL parameter

 

/a0q/e?CF00N40000001zNyc={!Project__c.Name}&CF00N40000001zNyc_lkid={!Project__c.Id}&retURL=%2F{!Project__c.Id}&saveURL=%2F{!Project__c.Id}

 

Step 2 - Create the custom button

 

Go to the Assignment object and create a new custom button

Set the options as follows:
Label - New Assignment
Display Type - List Button (uncheck the 'Display Checkboxes...' box)
Behavior - Display in existing window without sidebar or header
Content Source - URL

In the content area, paste the url you created

Click Save 


Step 3 - Add the Custom button to the related list

 

Go to your Project page layout
Scroll down to the Assignments related list and click the wrench to open the related list properties
Click the '+' in the Buttons section to expand the options
Deselect the standard New button
Select the New Assignment button from the Available Buttons and add it to the Selected Buttons
Click OK
Save the page layout


Good Luck!

This was selected as the best answer
ToddKruseToddKruse
CaptainObvious, that was SO OBVIOUS!  Thanks for the help.
Tomas.Ray2012Tomas.Ray2012

Hi Captain,

 

Your solution is working for  creation of child record.  How about updating existing child record? How to let system redirect me to parent page after updating a child record?

 

 

Thanks.

Thomas