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

Problem with onClick JavaScript For button was encountered
Hey all
I hope all is well, i really need some help wit the following below.
I have created the following button ( which sits on the campaign object)
However when i click on the button i get the following error message
This is the class, which i want the button to call. Anyone have any ideas why this is not working ?
i would like to point out i dont have a test class, and the code coverage is at 0%
This is the apex class which is called from the button
public String mysw {get; set;} Webservice static String initiateswapproval(String mysw) { //change Campaign__c to your sObject Campaign sw = new Campaign(Id=mysw); //make sure you add the custom field Submitted for Approval on your object as this is what you //will use as your approval process entry criteria. //This is the approval process entry I used: Entry Criteria (Campaign: Approved Date EQUALS null) AND (campaign: Submitted for Approval EQUALS TODAY) sw.Submitted_for_Approval__c = System.Now(); update sw; // Create an approval request for the record Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval automatically'); req1.setObjectId(mysw); Approval.ProcessResult result = Approval.process(req1); return null; } }This is my approval process. I know that the entry criteria is correct, however i am not sure about the approval steps
var cId = "{!campaing.Id}";
// call paex webservice
var result=sforce.apex.execute(
"Initiateapproval",
"initiateswapproval",
{mysw: cId});