You need to sign in to do that
Don't have an account?
Btuitasi1
Custom button: ILLEGAL TOKEN error
I am trying to create a button to insert a text value into a field upon clicking. Here is my code:
I am getting an illegal token error when I go to click it. Any ideas on how to fix this?
Thanks!
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} var newRecords = []; var idLob = new sforce.SObject(“Idea_Lobby__c”); idLob.id =”{!Idea_Lobby__c.Id}”; idLob.Vote_Test__c =(’Up‘) ; newRecords.push(idLob); result = sforce.connection.update(newRecords); window.location.reload();
I am getting an illegal token error when I go to click it. Any ideas on how to fix this?
Thanks!
It seems to be a problem with the single and double quotes and you the ('Up') should be 'Up' only:
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
It seems to be a problem with the single and double quotes and you the ('Up') should be 'Up' only:
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
I don't think this is possible but there's a way to get the same behavior:
1) Add the connection.js and a js var sessionId to your VF:
2) Create a js function enclosing the button's code:
3) Add to your commandButton an onclick event:
That should do the work.
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
Not sure as I don't have a holistic view of your scneario. What is the type of the field Vote_Test__c? Number or text? Because in your code you're just setting the text "Up" to your field, it's not working as a counter. If what you are looking for is that whenever the you hit the button, the number of votes gets increased you should consider changing your field Vote_Test__c to number and changing the following line as shown:
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.