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
XactAndyXactAndy 

Getting a handle on new object after save

Hi,

In the following function, is it possible to get a handle on the New Custom
Object once it has been saved? We're struggling to see how this is done.

    function create() {
      var newURL = "{!URLFOR( $Action.Directive__c.New ,null,null, true)}";
      window.parent.location.href = newURL;
    }

Thanks,

Andy
sfdcfoxsfdcfox
Salesforce does this by setting the retURL to the "view" URL. So, your code would appear as:
 
Code:
    function create() {
      var newURL = "{!URLFOR( $Action.Directive__c.New ,null,[retURL="/"&$ObjectType.Directive__c&"/o"], true)}";
      window.parent.location.href = newURL;
    }

This will instruct Salesforce to return you to the detail page of the record after saving the new record.
XactAndyXactAndy
Thanks.

Rather than returning to the newly created Directive, we want to process it by passing it to
an Javascript function. Is this possible? An example would really help us.

Thanks,

Andy