You need to sign in to do that
Don't have an account?
Split Comma seperated string in Javascript
Hi,
I have a situation where i m returing comma seperated string from a function and want to split this string in an array.
Here is what i m doing on Button click javascript but its gives me an error "message.Split is not a function"
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var oppId= "{!Opportunity.Id}";
var message= sforce.apex.execute("CreditMemo","CloneOpp",{oppId:oppId });
var result = message.Split(",");
var newOppId ='';
if (result.length > 0)
{
newOppId= result[1];
}
alert(result[0]);
if(result[0]== 'Success')
{
window.location="https://na14.salesforce.com/"+newOppId;
}
Any idea?
Ok i got the solution
Adding .toString() to
var message = sforce.apex.execute("CreditMemo","CloneOpp",{oppId:oppId }).toString();
make message as string and split work fine on it
Thanks