You need to sign in to do that
Don't have an account?
mohan s 37
syntax error & in java script button
Hi Friends,
I am geeting the following issue when i try to check the syntax error on onclick javascript button. "Syntax error &". in the following code. Can any one please help me resolving this issue.
Code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")}
try
{
var partnerType;
var accList = [];
var result = sforce.connection.query(
"Select Id, Name,Account__c,RecordType.Name,Account__r.Partner_Type_New__c FROM custom_c where id='{!custom__c.Id}' ");
var iter = new sforce.QueryResultIterator(result);
while(iter.hasNext())
{
var record=iter.next();
partnerType = record.RecordType.Name;
accList.push(record.Account__c);
}
if(partnerType=='customer')
{
sforce.apex.execute("SampleClass","sampleMethod1",{refreshAccList:accList});
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}";
}
else if(partnerType =='newcustomer'){
sforce.apex.execute("Sampleclass1","sampleMethod",{refAccList:accList});
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}";
}
}
catch(err){
alert(err);
alert("System is currently unable to process your request.");
}
I am geeting the following issue when i try to check the syntax error on onclick javascript button. "Syntax error &". in the following code. Can any one please help me resolving this issue.
Code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")}
try
{
var partnerType;
var accList = [];
var result = sforce.connection.query(
"Select Id, Name,Account__c,RecordType.Name,Account__r.Partner_Type_New__c FROM custom_c where id='{!custom__c.Id}' ");
var iter = new sforce.QueryResultIterator(result);
while(iter.hasNext())
{
var record=iter.next();
partnerType = record.RecordType.Name;
accList.push(record.Account__c);
}
if(partnerType=='customer')
{
sforce.apex.execute("SampleClass","sampleMethod1",{refreshAccList:accList});
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}";
}
else if(partnerType =='newcustomer'){
sforce.apex.execute("Sampleclass1","sampleMethod",{refAccList:accList});
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}";
}
}
catch(err){
alert(err);
alert("System is currently unable to process your request.");
}
Try that... also try and keep consitency throughout your code, if you chane from using single quotes to double quotes you will often make mistakes and issues... also ensure when you are saving in Salesforce, that all of the quotes and apostrophes are saved as them not as an HTML entity
All Answers
Try that... also try and keep consitency throughout your code, if you chane from using single quotes to double quotes you will often make mistakes and issues... also ensure when you are saving in Salesforce, that all of the quotes and apostrophes are saved as them not as an HTML entity
Thanks for your quick reply. Your answer is good but, some times it's not working.
Thanks,
Mohan S