+ Start a Discussion
Himanshu Patel 55Himanshu Patel 55 

Lightning Component: Java script button converted by SF Configurator tool

Hi, 

I have converted Java Script button through SF configurator and deployed it but not working in lightning. Below is the code. Not sure what's missing. 
Component
<aura:component extends="c:LCC_GenericLightningComponent" >
    <aura:set attribute="partially" value="false"></aura:set>
    <aura:set attribute="isAdditionalObject" value="false"></aura:set>

    <!-- User Interface -->
    <div>
        <div class="slds-scrollable slds-p-around_medium slds-text-heading_small" id="modal-content-id-1">
            <p class="slds-hyphenate"><a style="outline: 0;" href="https://github.com/developerforce/LEXComponentsBundle" target="_blank">Sample Lightning Component Action</a></p>
            <br/>
        </div>
        <footer class="slds-modal__footer">
            <lightning:button class="slds-button_brand" onclick="{!c.accept}" label="Accept"/>
        </footer>
    </div>

    <!-- The height of the modal is defined in Salesforce, when you create the new action. -->
    <!-- Recommended height size: 250px -->
	
</aura:component>
---------------------------------------------------------------------------------------------------------------
Controller 
({
    accept : function(component, event, helper) {
        $A.get("e.force:closeQuickAction").fire();
    }
})
({
	helperMethod : function() {
		
	}
})
-----------------------------------------------------------------------------------------------------------------
Java Script Button from Classic
//This code allows for the JS SOQL calls {!Account.Include_in_Retailer_Search__c}
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 

//Select the current Contact records and put it into the record variable 
var records = sforce.connection.query("SELECT Id, Agreement_Sent__c FROM Account Where id= '{!Account.Id}'"); 
var contactRec = records.getArray('records')[0]; 

//JS sees the number field as a string so this will make sure that 
//is a number - Number(contactRec.Emails_sent_count__c) 
contactRec.Agreement_Sent__c= Number(contactRec.Agreement_Sent__c) + 1; 

//Update contactRec object 
sforce.connection.update([contactRec]); 

//Reload the page 
window.location.reload();

 
SwethaSwetha (Salesforce Developers) 
HI Himanshu,
By not working are you seeing any errors?
Himanshu Patel 55Himanshu Patel 55
Hi Swetha, 

I am not getting any error when clicking on the button but it's not doing what needs to be done.

When i click on it, message appears as 'Sample Lightning Component Action' than only button named as 'Accept'