function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SabrentSabrent 

call to web services

How can I call this web service that's in an Apex class from Visual Force Page

 

WebService static String submitCourseRequirement(String requirementId) {
        return processRecordApprovalSubmission(requirementId, 'Requirement__c', new Requirement__Share());
    }

 

 

 

This is what i am doing in the visual force page

 

function Submit(reqId, seid, ccode){
       
        var answer = confirm("Would you like to proceed?");
      
            sforce.connection.sessionId = "{!$Api.Session_ID}";
           
        if (answer) {         

                try{          

                    var resultVal = sforce.apex.execute("StudentManagement","submitCourseRequirement", {requirementId:reqId});


                }catch(e){

                    ('This are not working: ' + e);

                } 


                ("Selected Note has been successfully submitted  for review.");

                return true;

                              

            }else{

                return false;

            }        

 

 

 

    <apex:commandLink action="{!saveComment}" rendered="{! NOT( exemptionCommentsBool)}" >
                        <apex:image id="theSubmitImage1" value="/servlet/servlet.FileDownload?file=015Q00000000z4M" width="50px" height="50px"/>
                    <apex:outputLink rendered="{!NOT(exemptionCommentsBool)}" value="{!$Page.SMRequirementsDownload}?seid={!StudentEngagement}" onClick="return Submit( '{!docReq.reqRecord.Id}', '{!StudentEngagement}', '{!CourseCode}');"/>
                    </apex:commandLink>

  

 

I know this is not the correct way because on click of the image, the function is not called. Can someone please point what i am doing wrong?

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
sfdeveloper9sfdeveloper9

Call a method in the controller class which calls the web service method.

 

public void controllerMethod(){

  class.submitCourseRequirement(requirementId);

}

All Answers

sfdeveloper9sfdeveloper9

Call a method in the controller class which calls the web service method.

 

public void controllerMethod(){

  class.submitCourseRequirement(requirementId);

}

This was selected as the best answer
SabrentSabrent

I can't thank you enough!