I have an onclick javascript button and converted this button to an lightning component(full) using the Lightning Experience Configuration Converter tool.

But,when I'm testing the converted button,onclick of it is showing me this error.I'm unable to fix this.I did a lot of research on this,and I couldn't find any appropriate solution.

Please give me some suggestions to fix this issue.

LCC converted button error


<aura:component extends="c:LCC_GenericLightningComponent">

    <aura:attribute name="partiallyConfirm" type="boolean" default="false"/>

    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
        <aura:renderIf isTrue="{!v.partiallyConfirm}">
            <div class="slds-m-bottom_x-large">
                <span><lightning:icon iconName="utility:warning" size="small"/></span><span class="slds-m-left_xx-small">This Js Button has been partially migrated. Contact with your System Administrator to review the functionality.</span>
        <p>'The current PY / CY State Directors will be overwritten with users based on the current mappings. Is this OK?'</p>
    <div class="slds-modal__footer">
        <lightning:button class="slds-button_neutral" onclick="{!c.yesResponse}" label="Yes" />
        <lightning:button class="slds-button_brand" onclick="{!c.noResponse}" label="No"/>



    yesResponse : function(component, event, helper) {

  sforce.apex.execute('OpportunityStateDirectorWS', 'setStateDirectors', {
  oppIds: [''+helper.idTruncate(component.get('v.sObjectInfo.Id'))+'']});


    noResponse : function(component, event, helper) {


apex class:

global without sharing class OpportunityStateDirectorWS {

    webservice static void setStateDirectors(List<Id> oppIds) {
        List<Opportunity> opps = [
            FROM Opportunity
            WHERE Id IN :oppIds ];

        update opps;

  1. Add controller to your component
<aura:component extends="c:LCC_GenericLightningComponent" controller="OpportunityStateDirectorWS">
  1. Change your controller method
yesResponse : function(component, event, helper) {
    let action = component.get('c.setStateDirectors');
    action.setParams({oppIds: [''+helper.idTruncate(component.get('v.sObjectInfo.Id'))+'']});
    action.setCallback(this, function(response) {
        let state = response.getState();
        if (state === 'SUCCESS') {
        } else if (state === 'ERROR') {
            //handle error
  1. Add @AuraEnabled descriptor to setStateDirectors method in OpportunityStateDirectorWS class.
global without sharing class OpportunityStateDirectorWS {
    webservice static void setStateDirectors(List<Id> oppIds) {
       // method code
| improve this answer | |
  • Hi I'm again getting an error "Uncaught Unable to find action 'setStateDirectors' on the controller of c:LCC_Update_State_Director_Opportunity". – Maneesh J Aug 7 '19 at 8:42
  • Have you added 'controller="OpportunityStateDirectorWS"' to <aura:component> tag? Could you check if apex class 'OpportunityStateDirectorWS' exists? – BlackCat Aug 7 '19 at 8:55
  • Yes there is a class called OpportunityStateDirectorWS – Maneesh J Aug 7 '19 at 9:26
  • I think I know what the problem is. Please add @AuraEnabled descriptor to setStateDirectors method in OpportunityStateDirectorWS class. Also, I have updated description. – BlackCat Aug 7 '19 at 9:43
  • Thank you so much BlackaCat. It's working. – Maneesh J Aug 7 '19 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.