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
sfdc dev 2264sfdc dev 2264 

Campagin member object help needed

Hi ,

I need help on below requirement as follows,

I am having a campiagn member object record

I want to have a custom button on campiagn member called "Convert opportunity"

on click of it should take me to opportunity record  creation page with the account tagged in campaign member to be automatically tagged on account field on opportunity

If i go back to campiagn member and change the account and click on the convert opportunity again it should reflect the new account tagged to that respective campiagn member

Help me how to acheive this]

Thanks in Advance

 
Best Answer chosen by sfdc dev 2264
mohdAnasmohdAnas

Hi,
step:
1. Create the button as shown in the image by selecting the content source as URL and pass the url as shown 
    note: If you to get URL in you specific org you do this by going to the new opportunity entry page and select the url from the browser URL bar.
2.    To get the id of account lookup in the new opportunity entry page in your organization by right click on the input box and select inspect.
3.    in the end pass the "campaign member acount lookup field" in the id as an parameter in the URL when creating a button.User-added image

this method is known as URL hacking; seach more to learn further . 

hope it helps 

good day!

All Answers

GauravGargGauravGarg
Hi, 

Cretae an onExecutive Javascript button. 
1. Bind Account Id on Campaign record with opporutnity Account Id. 
2. Open Opportunity create page with open link to: "https://instance.salesforce.com/006/e"

Take a look to this link: http://www.jitendrazaa.com/blog/salesforce/create-and-update-records-using-javascript-button-in-salesforce-ajax-toolkit/
Hope this helps.

Thanks,
Gaurav
sfdc dev 2264sfdc dev 2264
Could you please help me with the code pls


I tried the below code

bvut on click it says opportunity not defined


{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")} 

var accnt = new sforce.SObject("Opportunity");
Opportunity.Account = '{!CampaignMember.Related_Account__c}';


var result = sforce.connection.update([accnt]);
if(result[0].getBoolean("success"))
{
   alert('Account updated successfully');
   window.location.reload();
}
else{
  alert('Error : '+result);
}
mohdAnasmohdAnas

Hi,
step:
1. Create the button as shown in the image by selecting the content source as URL and pass the url as shown 
    note: If you to get URL in you specific org you do this by going to the new opportunity entry page and select the url from the browser URL bar.
2.    To get the id of account lookup in the new opportunity entry page in your organization by right click on the input box and select inspect.
3.    in the end pass the "campaign member acount lookup field" in the id as an parameter in the URL when creating a button.User-added image

this method is known as URL hacking; seach more to learn further . 

hope it helps 

good day!

This was selected as the best answer
sfdc dev 2264sfdc dev 2264
bro you are great , it worked :)

Thanks
mohdAnasmohdAnas
pleasure was all mine brother