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
Janette Mosher 6Janette Mosher 6 

Replacing New button in console related list

I want to replace the New button on a related list in Console. Opening the new record in edit mode as a subtab. I am populating some fields on the child record. See code below.
The new record is created fine with the fields populated correctly, however the new record replaces the existing primary tab and does not open in edit mode. Suggestions?

{!REQUIRESCRIPT("/xdomain/xdomain.js")}
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}
{!REQUIRESCRIPT("/support/console/30.0/integration.js")} 

var pl = new sforce.SObject("Proposed_Labor_Line_Item__c");

pl.Proposed_Work_Order__c= "{!Proposed_Work_Order__c.Id}"
pl.Case__c="{!Proposed_Work_Order__c.CaseId__c}"


var result = sforce.connection.create([pl]);
if(result[0].getBoolean("success")){
if (typeof(srcup) == 'function') 
{srcup(window.location = "/" + result[0].id);
} else {
window.location = "/" + result[0].id;
}

}else{
alert('Could not create record '+result);
}