You need to sign in to do that
Don't have an account?
Stavros McGillicuddy
Invalid or Unexpected Token Error
I am trying to update the Sample_QB_Error__c field with Hello
This code throws "an Invalid or unexpected token"
Thanks
This code throws "an Invalid or unexpected token"
Thanks
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} var record = new sforce.SObject("Opportunity"); record.Id = ‘{!Opportunity.Id}’; record.Sample_QB_Error__c ="Hello"; sforce.connection.update([record]); window.location.reload();
Try the below updated code
All Answers
Try the below updated code
That fixed it but, I can't see the difference between your code and mine (scratching head)
Thank you Karanajs.
Friends, could you help me with this code and that is resulting in the same error?
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
// Does a post request
_SendExtend.postAjax = function (url, callback, data) {
var ajaxRequest = _SendExtend.getAjaxRequest(callback);
ajaxRequest.open("POST", url, true);
ajaxRequest.setRequestHeader("Content-Type", "application/json");
ajaxRequest.setRequestHeader("Connection", "close");
ajaxRequest.send("data=" + encodeURIComponent(data));
};
// Returns an AJAX request obj
_SendExtend.getAjaxRequest = function (callback) {
var ajaxRequest;
try {
ajaxRequest = new XMLHttpRequest();
} catch (e) {
try {
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return null;
}
}
}
ajaxRequest.onreadystatechange = function () {
if (ajaxRequest.readyState == 4) {
// Prob want to do some error or response checking, but for
// this example just pass the responseText to our callback function
callback(ajaxRequest.responseText);
}
};
return ajaxRequest;
};
var _SendExtend = _SendExtend ? _SendExtend : new Object();
function processResponse(responseText) {
// Response text is a json:
//var obj = JSON.parse(responseText) // won't work all browsers, there are alternatives
alert(‘Call succeeded ’ + responseText);
}
var jsonToPost = “";
//Here is where the variable would be replaced // + '[CRMAccountId]';
//TEST Environment
var url = "https://boomiqa1.sanjuan.avalara.com/ws/rest/provisioning/admin/v1/extend/0011900000QNFO9AAP /“;
//PRODUCTION Environment
//var url = "https://boomiprod1.sanjuan.avalara.com/ws/rest/provisioning/admin/v1/extend/" + “[CRMAccountId]";
_SendExtend.postAjax(url, processResponse, jsonToPost);
We're simply trying to send the Account ID to an external end point.
{!requireScript("/soap/ajax/40.0/connection.js")}
alert("DID WE DO ANYTHING?");
varselectedAccountIds = {!GETRECORDIDS($ObjectType.Account)};
varaccountsForUpdate = [];
if (selectedAccountIds[0] == null) {
alert(“You must select at least one record”);
} else {
for (vari = 0; i < selectedAccountIds.length; i++) {
var account = new sforce.SObject(“Account”);
account.Id = selectedAccountIds[i];
account.Target_Account__c = TRUE.toISOString();
accountsForUpdate.push(account);
}
}
varsaveResult = sforce.connection.update(accountsForUpdate);
location.reload(true);
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var obj;
var task5;
var recordtypeid;
var followup;
var recordtypefol;
if("{!$Profile.Name}" == "TX1" ||
"{!$Profile.Name}"== "TX2"||
"{!$Profile.Name}"== "WX1"||
"{!$Profile.Name}"== "WX2"||
"{!$Profile.Name}"== "WX3"||
"{!$Profile.Name}"== "WX4"||
"{!$Profile.Name}" == "CC"){
obj='a1r';
}
else{
obj='00T';
}
alert(obj);
var url='/'+obj+'/e?CF00N50000002CzJi={!Account.Name}&CF00N50000002CzJi_lkid={!Account.Id}&retURL=/{!Contact.Id}&title=Call&who_id={!Contact.Id}&00N50000002D0zP={!User.Primary_Product__c}'
if(obj=="a1r")
{
url+='&followup=1&tsk5=call'
}
if(obj=="00T"){
if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AS - E"||"{!$UserRole.Name}"=="AS - M"||"{!$UserRole.Name}"=="AS - T")){
task5="Meeting";
recordtypeid="0123B0000008tqK";
followup='';
recordtypefol="0123B0000008tqK";
}elseif("{!$Profile.Name}" == "WI Corporate Sales") {
task5="call";
recordtypeid="01250000000HiDD";
followup ="1";
recordtypefol="01250000000HiDD";
}else{
url+='&tsk5='+task5+'$tsk12=Completed'+'&RecordType='+recordtypeid+'&RecordType_fu='+recordtypefol+'&followup='+followup+'&tsk4={!TODAY()}'
}
}
else{
url+='&followup=1&tsk5=call'
}
window.parent.open(url, "_self");
I am trying to write a simple JS button on opportunity to toggle a picklist based on its existing value. When I run it I get an error.
Check whether Sync Flag not set to 'Sync' and update it to 'To Be Sync'. Not sure why I am getting this error. Please help! Thanks!!
Button:
Error:
@Karanraj
@Stavros McGillicuddy