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
ksparkspar 

{!Opportunity_ID} always empty (for some reason?)

Hi, I created an s-control that simply displays some account, contact and opportunity fields in a javascript alert:

alert("contact id: {!Contact_ID} \nacct id: {!Account_ID} \nopportunity id: {!Opportunity_ID} \nacctname: {!Account_Name} \nopportunity name: {!Opportunity_Name} \ndrivercount: {!Opportunity_NumberofDrivers}");

BUT, the Opportunity_ID is always empty. It appears to be that way whether I use the "convert lead" button in Leads or use convertLead() through the sforce6 API. In both cases, I am definitely selecting the "create opportunity" option.

Is there a concept or two that I'm overlooking?

Thanks,
David
ChitraChitra
Hey..

From where exactly are you invoking the Scontrol. I m not sure if the Opportunity is in the Scope of the Page. If it is in Scope then check if the merge field name is correct.

Thanks,
Chitra
ksparkspar
I think you've nailed it. It's invoked from the Contacts page. The Contact seems to have knowledge of the Account that it's linked with, but not the Opportunity. (And the sobject/Contact.java seems to support that.) I guess I could store the Opportunity ID in the Contacts table (in a custom field like OpportunityID__c) during convertLead which I'm executing from a Java app.

OK, so I just created a custom link to invoke the s-control from the Opportunities page and it gave me the id's for the Account and Opportunity object and not the Contact object. So both Contact and Opportunity know about their associated Account, but not about each other. Guess it's not obvious to me why that would be the case of an Opportunity can't be meaningful without an Account... or can it?

Thanks for educating me! At least I know how to move forward on this now...
David