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
drewpiston.ax678drewpiston.ax678 

Inability to Cancel after creating a new record from a URL custom button

I'm trying to create a generic URL list button that skips the Record Type selection for a new custom object called "Referral."  It can't be specific to one org, so I'm using the URLFOR function.  The button lives on a related list of a custom object called "Program."

 

Here's what we have:

 

{!URLFOR( $Action.Referral__c.New , null, ["p3"='012A0000000DTUP', "CF00NA0000000u8Zx"= Program__c.Name, "save"=1], true)}

 

This works fine, but if the user clicks on the "cancel" button from the new Referral data entry page, it doesn't return back to the Program record which had the button, it just reloads the new Referral entry page screen.

 

Any ideas?  I've tried passing values for cancelURL and retURL in the parameters for the URLFOR function, but with no luck.

 

Thanks,

 Drew

werewolfwerewolf

Yeah, that's because you have the save=1 parameter in there.  You're telling it to save the record immediately, so naturally pressing Cancel would have no effect, since the record is already saved.

drewpiston.ax678drewpiston.ax678

Thanks Werewolf - that makes sense.

 

For some reason I was under the impression that the only way to skip record type selection was to include the save=1 parameter.  Do you know if I'm mistaken, and there's another way?

werewolfwerewolf

You are indeed mistaken about save=1.  That saves the page.  If you'd like to skip record type selection, have your button mimic the URL that you see after you've selected the record type.

drewpiston.ax678drewpiston.ax678

Thanks Werewolf.

 

I am able to skip record type selection by mimicking the url after record type selection, but the resulting button only works in one org.  I was hoping to create code that would work in any org, which is why I was using the {!URLFOR} function, which is why I needed to add the save=1 parameter (because doing so allows you to skip record type selection).

 

Perhaps there is no good way to make a button that skips Record Type selection and can be used in any org.  Come to think of it, the Recod Type ID would probably be different in different orgs, so even if there were my button probably wouldn't work.

 

Thanks for the input!

 Drew