+ Start a Discussion
Money Care 7Money Care 7 

Error: Function REQUIRESCRIPT may not be used in this type of formula

Hi I have created a custom button to call apex class but it is showing error like

Error: Function REQUIRESCRIPT may not be used in this type of formula

Error: Enter a URL that is valid and well-formed

 
{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")} 
var msg =sforce.apex.execute("SendTigerTuesday","Tuesday", {id:"{!TigerTuesday__c.Id}"}); 
window.alert(msg); 
window.location.href=location.href;

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Add this to the button.

 
{!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")}

Please see below post which has a similar discussion.

https://developer.salesforce.com/forums/?id=906F0000000BXc0IAG

Please let us know if this helps you.

Thanks and Regards
Sandhya.
Ishwar ShindeIshwar Shinde
Hello,

Connection.js and Apex.js are part of AJAX Toolkit. You can simply include these files in your code as follows:

<script src="/soap/ajax/28.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/28.0/apex.js" type="text/javascript"></script>
 
Change the API version if you have other than 28.0, if you wish to see the content of file then you can simply hit  https:/instance.salesforce.com/soap/ajax/28.0/connection.js and get the code.
 
For details on AJAX toolkit refer:http://www.salesforce.com/us/developer/docs/ajax/