You need to sign in to do that
Don't have an account?
bharath kumar 52
Ajax/Soap API not working in javascript
Hi All,
Below is the piece of code which is executing in salesforce platform(flawlessly) but not in communities(When i execute the below code in communities i am able to get a javascript alert and nothing beyond that). Would be glad if someone can tell me where im going wrong.
Thanks,
Bharath
Below is the piece of code which is executing in salesforce platform(flawlessly) but not in communities(When i execute the below code in communities i am able to get a javascript alert and nothing beyond that). Would be glad if someone can tell me where im going wrong.
{!REQUIRESCRIPT("/soap/ajax/34.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/34.0/apex.js")} var p = new sforce.SObject('Deal__c'); p.id = "{!Deal__c.Id}"; function fixTime(time){ if(time < 10) {time = "0" + time}; return time; } function fixDate(date){ var Month = fixTime(date.getMonth() + 1); var Day = fixTime(date.getDate()); var UTC = date.toUTCString(); var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6); var Minutes = fixTime(date.getMinutes()); var Seconds = fixTime(date.getSeconds()); return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time; } var oldStat = "{!Deal__c.Status__c}"; if(oldStat == 'Closed'){ alert(' This deal is already closed '); } else{ p.Status__c = "Closed"; p.End_date__c = fixDate(new Date()); var result = sforce.connection.update([p]); window.location.reload(); }
Thanks,
Bharath
It's an onclick button in a page layout not a vf page.
Thanks for the reply.