You need to sign in to do that
Don't have an account?
Mateo Alcauter
How to call a custom field on javascript
I'm creating a custom button using onclick javascript. I have called the custom object that i'm working with, but i'm unable to call any custom fields of this custom object. I highlited the line that is not working properly.
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
var records = {!GETRECORDIDS($ObjectType.Transaction__c)};
var strIDs='';
if (records[0] == null)
{
alert('Please select a record');
}
else
{
for (var n=0; n<records.length; n++)
{
strIDs = records[n];
alert(strIDs.Total_Fee__c);
}
alert('Success');
}
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
var records = {!GETRECORDIDS($ObjectType.Transaction__c)};
var strIDs='';
if (records[0] == null)
{
alert('Please select a record');
}
else
{
for (var n=0; n<records.length; n++)
{
strIDs = records[n];
alert(strIDs.Total_Fee__c);
}
alert('Success');
}
check the below link for sample code :
https://developer.salesforce.com/forums/?id=906F00000008rtUIAQ
check last reply of Zachary Alexander 30
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
All Answers
check the below link for sample code :
https://developer.salesforce.com/forums/?id=906F00000008rtUIAQ
check last reply of Zachary Alexander 30
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
var result = {!GETRECORDIDS($ObjectType.Transaction__c)};
var cycleTransactions = new Array();
var myquery = ('SELECT Id, Submit_for_Approval__c FROM Transaction__c WHERE Id in (\'' + result.join('\',\'') + '\')' );
var queryResults = sforce.connection.query(myquery);
var records = queryResults.getArray("records");
if (records == null)
{
alert('Please select a record');
}
else
{
for (var n=0; n<records.length; n++)
{
alert(queryResults.records[n].Id);
queryResults.records[n].Id.Submit_for_Approval__c = true;
}
alert('Success');
}
I get this
{type:'Transaction__c', Id:'a065B000002YO2xQAG', Submit_for_Approval__c:'false', }