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

How to Add Relation ship field Id to javascript Button
How to Add Relation ship field Id to javascript Button...For Example: Account Address(Account_Address__c) Object. In this object i have a Account__C( field) value Which has a Master Detail Relation ship with Account.
Now created a Javascript Button on Account_Address__C detail page . nOw my requirement is i have to send Account_Address_Id and Account__c.Id Through this button ...How can i do that Please help me ...i ried the below code
Button:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
//alert('hi');
if('{!Account_Address__c.Id}'!= null)
{
alert('Do You Want To Create A SAP Account');
var AcctAddressID='{!Account_Address__c.Id}';
Var AccountID='{!Account_Address__c.Account__c.ID}'
sforce.apex.execute("Bandvidth CreateUpdateSAPAccountAddress","createupdateSAPAccountAddress",{AcctAddressID:"{!Account_Address__c.Id}",{AccountID:"{!Account_Address__c.Account__c.ID}});
}
Am getting below Error while saving the button:
Error: Field Account_Address__c.Account__c.ID does not exist. Check spelling.
Please help me..thanks
Now created a Javascript Button on Account_Address__C detail page . nOw my requirement is i have to send Account_Address_Id and Account__c.Id Through this button ...How can i do that Please help me ...i ried the below code
Button:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
//alert('hi');
if('{!Account_Address__c.Id}'!= null)
{
alert('Do You Want To Create A SAP Account');
var AcctAddressID='{!Account_Address__c.Id}';
Var AccountID='{!Account_Address__c.Account__c.ID}'
sforce.apex.execute("Bandvidth CreateUpdateSAPAccountAddress","createupdateSAPAccountAddress",{AcctAddressID:"{!Account_Address__c.Id}",{AccountID:"{!Account_Address__c.Account__c.ID}});
}
Am getting below Error while saving the button:
Error: Field Account_Address__c.Account__c.ID does not exist. Check spelling.
Please help me..thanks
currently salesforce do not support use of related objects fields as merge fields in JavaScript, instead you would need to query first, fetch the result and then pass it, for eg.,
var result = sforce.connection.query("SELECT id from Account__c where name LIKE '{!Account__c}' '");
// And then fetch the value from there
OR
Since you were anyway using method, get only addressid and query rest of the details in the method itsself
OR
Create a formula field in Account Address which has AccountId value and then just refer that field in the javascript.
you can choose either of the above
Thanks,
balaji
All Answers
currently salesforce do not support use of related objects fields as merge fields in JavaScript, instead you would need to query first, fetch the result and then pass it, for eg.,
var result = sforce.connection.query("SELECT id from Account__c where name LIKE '{!Account__c}' '");
// And then fetch the value from there
OR
Since you were anyway using method, get only addressid and query rest of the details in the method itsself
OR
Create a formula field in Account Address which has AccountId value and then just refer that field in the javascript.
you can choose either of the above
Thanks,
balaji
After I click on button
Error:Fault Code No such parameter defined for the Opration Error
My Modified Code:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
//alert('hi');
if('{!Account_Address__c.Id}'!= null)
{
alert('Do You Want To Create A SAP Account');
var AcctAddressID='{!Account_Address__c.Id}';
var accountID='{!Account_Address__c.Account_ID__c}';
sforce.apex.execute("SandvineCreateUpdateSAPAccount","createupdateSAPAccount",{AcctAddressID: "{!Account_Address__c.Id}",accountID:"{!Account_Address__c.Account_ID__c}"});
}
Thanks,
Balaji