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
gregj777gregj777 

Detail Page Button

I am trying to create a custom detail page button called Create Opportunity on Campaign object. So when the user clicks it opens the opportunity object with the linked Campaign name. 

Both the related Opportunity and Campaign objects are in the related list. I know if the user scroll down in Campagns they could click on the NEW in the Oppportunity sections and that will work the same way. I just want to make it convenient for them to be able to have the button at the top.

This is what currently have but it doesn't seem to be pulling the Campaign Name.

 

https://cs10.salesforce.com/006/e?retURL=%2F006%2Fo
var records = {!GETRECORDIDS( $ObjectType.Campaign)}

 

Can some help me with this?

 

Best Answer chosen by Admin (Salesforce Developers) 
TrimbleAgTrimbleAg

This is for a URL button, not a Java.

 

 

 

006/e?retURL=%2F006%2Fo
&opp17={!Campaign.Name}&opp17_Ikid={!Campaign.Id}

 

The copy and paste this in your button, this will create a Opportunity from a Campaign and carry over the campaign name and ID.

 

PB

All Answers

TrimbleAgTrimbleAg

It is opening a new Oppurtunity correct?

 

The issue is just setting the Campaign field?

 

PB

gregj777gregj777

Yes that is correct.

TrimbleAgTrimbleAg

Check out my recent thread here.

 

http://boards.developerforce.com/t5/General-Development/Need-Help-with-URL-button/td-p/389733

 

At the bottom I provide the method to correct your issue.

 

PB

TrimbleAgTrimbleAg

Ok, So since its a standard field, if you look at the code I had, you can refer to the standard fields. Now I dont know if is the same, but belive if you can determine what value to use in the bold writing you will be able to find the field.

 

&cas4={!Account.Name}

&cas11=Web

 

The &cas# refers to the standard fields, now I am not sure if how to refer to the opp, maybe &opp4={!Campiang.Name}

 

Now I just played with the &cas using different number to see where items were being imputed.

 

I do not know how to tell the actual mapping.

 

PB


gregj777gregj777

Sorry you lost me...so the javascript for the Detail button will look like this:

 

&opp4={!Campaign.Name}

&cas11=Web

TrimbleAgTrimbleAg

I am not exactly sure how it will look because I do not know what statement should be used.

 

I am assuming that "&Cas" refers to cases, and the number is the identifier on the field.

 

So my best guess would be &opp#= would be the statement, but you have to change the number to detemine what field it really is, because I dont know how to find the number that is tied to the field.

 

&cas4={Account.Name} This was the standard lookup field on cases, this inserted the name list on the other object.

&cas11=Web  - This was the standard Origin field, i set the vaule here

 

If you can determin what statement should actually be used, then you can play around and field the actual number of the field.

 

Sorry wish I could be more help, serach the forum, or call standard support to see if they can shed some light.

 

PB

TrimbleAgTrimbleAg

Ok, so you got me going and after testing this is what i found....

 

I wrote a button like this once I found that &opp was the correct statement like I had thought.

 

/006/e?retURL=%2F006%2Fo
&opp1=1
&opp2=2
&opp3=3
&opp4=4
&opp5=5
&opp6=6
&opp7=7
&opp8=8
&opp9=9
&opp10=10
&opp12=12
&opp13=13
&opp14=14
&opp15=15
&opp11=11
&opp16=16
&opp17=17
&opp18=18
&opp19=19

 

Then use the button and the fields will have the values I posted in the above statement.

 

 

Opp17 is the primary campaign soruce

 

So your code should look like

 

&Opp17={!Campaign.Source} Or what ever the value is...

 

PB

 

 

 

gregj777gregj777

Still having issues, sorry. But I don't understand what &opp17 means? What does is the "17" from?

 

Here is what I did:

Created Detail Link button on Campaign object called "Create Opportunity"

Onclickjavascript

Code: &opp17={!Campaign.Name}

 

Test Campaign object:

Click "Create Opportunity"

Error - Unexpected token &

 

 

TrimbleAgTrimbleAg

This is for a URL button, not a Java.

 

 

 

006/e?retURL=%2F006%2Fo
&opp17={!Campaign.Name}&opp17_Ikid={!Campaign.Id}

 

The copy and paste this in your button, this will create a Opportunity from a Campaign and carry over the campaign name and ID.

 

PB

This was selected as the best answer
gregj777gregj777

Thanks so much. I am going to try and create one now for "Create Contract"

gregj777gregj777

I am trying to figure where do I get &cas?  values from. So the new button I am creating for "Create Contract" is in the Opportunity object. The below works but doesn't populate with the account name.

 

https://cs10.salesforce.com/800/e?retURL=%2F800%2Fo

&cas4={!Account.Name}

TrimbleAgTrimbleAg

&cas referes to cases

&opp referes to opportunities

 

My guess would be &con would be for contacts.

 

Look at my earlier example for testing to determine what field number is actuall being referenced.

 

PUT THE URL HERE

&con1=1

&con2=2

ect.

 

go up to 20, then save and test the button. Once you test the button you will see values imputed into the fields. what ever number shows up in the account field, you know the same &con# referes to that field.

 

PB

 

PB

gregj777gregj777

O.k. I am beginning to understand. Where do I find a list of the syntex for these fields. I need the one for CONTRACT. Can't seem to find them anywhere on the help site.

 

&opp = opportunity

&cas = case

&con = Contact

&acc = Account???

&contract??? etc.

TrimbleAgTrimbleAg

Good Luck!

 

I search for the same stuff, couldnt find anything....

 

It would be great if they had this out there and told us what the syntex is and what the numbering scheme is also...

 

If you find it, please do post.

 

I have just played around until I got it right.

 

PB

gregj777gregj777

o.k. I found this reference doing a google search:

http://salesforce.phollaio.com/2007/04/02/how_to_obtain_a_field_id/

 

&evt = event

&tsk = task

&cpn = campaign

&lea = leads

&acc = account

&con = contract

&opp = opportunity

&ctrc = contract

&con = contact


TrimbleAgTrimbleAg

 Great Stuff! Wow, that made it a whole lot simpler!

 

PB

gregj777gregj777

Yea it took me two days but I learned something. Thanks.

gregj777gregj777

Would you have any idea how to create a Quote button on the Opportunity page? That one I can't find on the list.

TrimbleAgTrimbleAg

I tested and cant even get it to pop a quote... I keep getting a error that the URL no longer exsist.  It has a different type of relationship than the others, not sure it is even possible with the method I know.

 

Sorry.

 

PB