You need to sign in to do that
Don't have an account?

Function REQUIRESCRIPT may not be used in this type of formula
Hi Guys
I am facing this issue now when i am calling class uisng javascript like
Error: Function REQUIRESCRIPT may not be used in this type of formula
I am facing this issue now when i am calling class uisng javascript like
Error: Function REQUIRESCRIPT may not be used in this type of formula
global class SendTigerTuesday { public static blob b; WebService static string Tuesday(string id) { try { TigerTuesday__c qt=[Select id,Mail_Id__c,CreatedBy.name,Name, Issue_Date__c,Issue__c from TigerTuesday__c where id=:id]; PageReference pdf =new PageReference('/apex/TigerTuesDayPDF?scontrolCaching=1&id='+Id); pdf.setRedirect(true); if(Test.isRunningTest() == false){ b = pdf.getContent(); } //--------create a mail object to send a single email.-------- Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); string[] toaddress =String.valueOf(qt.Mail_Id__c).Split(','); mail.setToAddresses(toaddress); // mail.setToAddresses(new string[] {qt.email__c}); // Internal_Email_User_Id__c text fied mail.setBccAddresses(new String[] {'maheswar@globalnest.com'}); mail.setBccSender(true); mail.setSenderDisplayName(qt.CreatedBy.name); //mail.setSubject('News Flash For'+' '+qt.Company_Name__c); mail.setSubject('TigerTuesDay,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c); //------------- Create the email attachment----------------- Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName('TigerTuesDay.pdf'); efa.setBody(b); //----------------------------------------------------------- mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); //mail.setPlainTextBody('Hi Sir/Madam, Please find the News Flash for '+qt.Company_Name__c +'\n'+'\n'+'Thanks & Regards'+'\n'+qt.CreatedBy.name); mail.setPlainTextBody('Dear Tiger Friend ,' + '\n' + '\n' + 'USAID’s Bagh Activity would like to share its weekly bulletin- TigerTuesday,'+' '+'Issue'+' '+qt.Issue__c +' '+'Dated '+' '+qt.Issue_Date__c+'.'+'\n'+'\n'+'Thanks & Regards'+'\n'+'\n'+qt.CreatedBy.name); //------------------------Attach sales order to a contract-------------------- Attachment formAttach = new Attachment(); formAttach.Name = 'TigerTuesday'+qt.Name+'.pdf'; formAttach.body = b; formAttach.ContentType='application/pdf'; formAttach.parentId =id; if (!Test.isRunningTest()) { insert formAttach; } //send the email Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail } ); return 'TigerTuesDay PDF has been sent'; } catch(exception ex) { string ex1=string.valueof(ex); return ex1; } } }
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} var msg =sforce.apex.execute("SendTigerTuesday","Tuesday", {id:"{!TigerTuesday__c.Id}"}); window.alert(msg); window.location.href=location.href;
Please try to use below one.
Please let us know if this helps you!
Thanks and Regards
Sandhya
You need to place all your javascript code inside the script tag.
Please refer below link you can get more information.
http://salesforce.stackexchange.com/questions/105692/function-requirescript-may-not-be-used-in-this-type-of-formula
Thanks and Regards
Sandhya