You need to sign in to do that
Don't have an account?
Jonathan Bernd 31
How do I bind an incoming Salesforce picklist value to a javascript variable
Newbie question. I want to use Javascript to conditionally return values based on the incoming value from a Salesforce picklist field.
(I know I can make conditional fields in SF, but I want to figure out how to get a variable from what comes from SF so I can use it in javascript).
Here's the example without Salesforce fields that works fine:
(I know I can make conditional fields in SF, but I want to figure out how to get a variable from what comes from SF so I can use it in javascript).
Here's the example without Salesforce fields that works fine:
<script> var myfirst = 'This'; var mysecond = 'That'; var inpvariable = 'Banana'; if(inpvariable =='Coffee') document.write(myfirst); else document.write(mysecond); </script>Here is what I want to do with an incoming picklist field
<div class = "mypage"> {!Opportunity.StageName} </div> <script> var myfirst = 'This'; var mysecond = 'That'; var myother = 'Other'; var inpvariable = {!Opportunity.StageName}.value; if(inpvariable =='Prospecting') document.write(myfirst); else if (inpvariable =='Proposal/Price Quote') document.write(second); else document.write(myother); </script>Help would be greatly appreciated. Thanks in advance
You need to get the value of within single quotes like shown below. This works in Javascript. Thanks
AR
If this resolves your problem please mark it as best answer.
All Answers
You need to get the value of within single quotes like shown below. This works in Javascript. Thanks
AR
If this resolves your problem please mark it as best answer.