+ Start a Discussion

How to skip Record Type selection when calling a prepopulated edit page.

Hello, I have the following problem: I made an S-Control which is triggered by a button in custom object "Repair" and redirects to "new opportunity" edit screen with some values prepopulated from the Repair. However we use record types in opportunities and each time I have to select the record type first before the edit page appears (despite all opportunities created from Repairs should have the same record type). Is it possible to pass the record type in the URL, so the manual record type selection will be skipped? Here is the code:

var newUrl = "{!URLFOR($Action.Opportunity.New,null,[saveURL=URLFOR($SControl.Update_Repair, Repair__c.Id), retURL = $Request.retURL] ,true)}";

newUrl = newUrl + "&opp3=" + "Repair for " + {!Repair__c.Name} + "&00N200000003EQc=" + 'Repair' + "&opp4=" + "{!Repair__c.Account__c}";


Try appending RecordTypeId to the url
newUrl += "&RecordType=<yourRecordTypeId>";

Thanks, but it didn't changed anything. The link still calls to the record type selection screen first.
It seems like URLFOR will always take you to the rec type selector. Use this URL instead:

var newUrl = "/006/e?retURL=%2F{!Repair__c.Id}&opp3=Repair for {!Repair__c.Name}&00N200000003EQc=Repair&opp4={!Repair__c.Account__c}&RecordType="+someRecordTypeVar;

That should take care of what you need. You'll need to do a query to find the record type by name, and get the Id.


Did this work for anyone?