You need to sign in to do that
Don't have an account?

Having problem while passing custom field values to onclick javascript button?
Hi All,
I am unable to pass the custom field values to the below alert box. My scenario is like when i click on the custom button, i need to pass item_id__c via url to open the visual page.
var Account = "{!Account.Id}";
var AccountName = "{!Account.Name}";
var ItemName= "{!Account.Item_ID__c}";
if(Account!=null)
{
alert('Account'+ItemName);
window.open('https://www.google.com?item='+ItemName);
}
I am unable to pass the custom field values to the below alert box. My scenario is like when i click on the custom button, i need to pass item_id__c via url to open the visual page.
var Account = "{!Account.Id}";
var AccountName = "{!Account.Name}";
var ItemName= "{!Account.Item_ID__c}";
if(Account!=null)
{
alert('Account'+ItemName);
window.open('https://www.google.com?item='+ItemName);
}
I assume you are trying to pass the Id for Item_ID__c in the URL. if so,you will have to use merge field. Like, OppID={!Opportunity.Id}.
So, in your case, it would be window.open('https://www.google.com?item={!itemName}');
Hope this solves your issue. :)
Hit Kudos id this the correct asnwer.
Thanks for the response.
I didn't understand why you mentioned OppID={!Opportunity.Id}. Item_Id__c is a custom field in account and it is not linked with opportunities.
var Account = "{!Account.Id}";
var AccountName = "{!Account.Name}";
var ItemName= "test";
if(Account!=null || Account!='')
{
alert('Account'+ItemName);
window.open('https://www.google.com?item='+ItemName);
}
</script>
I tweaked your script
Try this one....
Thanks for your response.
In my case i need to pass dynamic values to ItemName.