You need to sign in to do that
Don't have an account?
Riptide
I can't get Opportunity ID on page load
Hi Everyone,
For some reason I can't get the Opportunity ID value on the page load event in an S-Control. Here is the very simple code:
<html>
<script type="text/javascript">
function init() {
window.alert("{!Opportunity.Id}");
</script>
<body onload="init()">
</body>
</html>
<script type="text/javascript">
function init() {
window.alert("{!Opportunity.Id}");
</script>
<body onload="init()">
</body>
</html>
My expectation is that the message box would have the Opportunity ID in it but it doesn't. I don't really want a message box. I want to use the Opportunity ID in a query but I just wrote this to test. I've used similar code on the lead form and it works fine.
I have also tried dojo.addOnLoad(init) with the same results.
Any help on how to get the Opportunity ID when the page gets loaded would be much appreciated. This behavior isn't limited to the ID field. I can't get any values on the page load.
Thanks,
Steve
Hi,
Your code is correct only you are missing closing bracket of the function init().
I checked and it is working fine.
Thanks
Sunil
Message Edited by Sunil on 05-17-2008 02:25 AM
Hi Sunil,
Yeah, it is now working on my end as well. To make sure it wasn't a problem with my browser I shut down all my browser windows and logged back in to try again. Sure enough it started working. Must have been some kind of memory problem locally.
Thanks,
Steve