+ Start a Discussion
skausskaus 

Need to prompt user for opportunity record type

 Hi All,

 

I have this opportunity object for which many record types have been defined.
When user clicks on opportunity tab and then new opportunity button , it prompts for record type selection where as when user clicks on new opportunity button from the related list on account detail page , it takes the default record type value and doesn't prompt user.

I want to prompt user to choose a record type even when coming from account detail page. I have looked at profile record type setting and my personal record type setting has the checkbox unchecked.

Any idea why is it happening ? Is it because opportunity object has trigger defined on it?

I have the contract object for which record type prompt is always happending even though all record type settings are same as for opportunity object but contract doesn't have any trigger defined for it.

I am really baffled over it , and help would be greatly appreciated .

Thanks in advance.

 

 

NasipuriNasipuri

Hi ,

 

This is not a normal SFDC system nature with the Salesforce.com record Type.

 

The way we have described the behavior of the system , It seems that either the New Opportunity button has been overridden to have this dynamic behavior , or your system using standard New Button in the Opportunity Tab , but the New Opportunity Button in the Account detail PAge Opportunity Related List Section is a Custom Button , standard button has been removed from the page layout.

 

Thanks and Regards,

Dinesh Nasipuri

Dinesh.Nasipuri@gmail.com

skausskaus

Hi Dinesh,

 

Thank you so much for your reply. You are right , I found out the new button is overridden as following code :

 

parent.top.location.replace("/006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&RecordType=01270000000197K&00N70000001aeOC={!Account.SE_NO_FORM__c}&opp9="+closedDate+"&opp11="+oppStage+"&cancelURL=%2F{!Account.Id}&ent=Opportunity");

 

So, I changed this url as follows :

parent.top.location.replace("/setup/ui/recordtypeselect.jsp?retURL=%2F{!Account.Id}&accid={!Account.Id}&00N70000001aeOC={!Account.SE_NO_FORM__c}&opp9="+closedDate+"&opp11="+oppStage+"&cancelURL=%2F{!Account.Id}&ent=Opportunity");

 

Now problem is it keeps taking back to record type selection page , even after I select a record type and click on continue.

 

Please let me know if you have any idea about this.I'd really appreciate it.

 

Message Edited by skaus on 02-01-2010 10:23 AM
MycodexMycodex

@skaus To re-create functionality, just look how Salesforce formats the URL after you click New on the Opportunity tab. One key part of the URL you missed was this section:

 

&save_new_url=%2F006%2Fe%3FretURL%3D%252F006%252Fo

 

After you convert all the URL encoding, you get the following string:

 

&save_new_url=/006/e?retURL=%2F006%2Fo

 

%2F creates /

%3F creates ?

%3D creates =

%25 creates %

 

basically - after the user clicks Continue, save_new_url starts a new opportunity with a return url. This URL Salesforce provides sends you back to the Opportunity tab.  Yours would probably look more like this to send you back to the account:

 

/setup/ui/recordtypeselect.jsp?accid={!Account.Id}&00N70000001aeOC={!Account.SE_NO_FORM__c}&opp9="+closedDate+"&opp11="+oppStage+"&cancelURL=%2F{!Account.Id}&ent=Opportunity&save_new_url=%2F006%2Fe%3FretURL%3D%252F{!Account.Id}

 

Just so you're aware, URL hacks like this are not supported by Salesforce and are prone to not work in the future. I'd recommend you add these buttons to your regression testing when Salesforce puts a release into sandbox preview.