Skip to main content

Hi Everyone, I am new to salesforce and need some guidance to convert a javaScript button to lightning. I have already checked a few resources such as: 

 

https://developer.salesforce.com/blogs/2018/06/convert-javascript-buttons-to-lightning-friendly-alternatives-with-the-lightning-experience-configuration-converter.html

 

https://trailhead.salesforce.com/content/learn/modules/lex_javascript_button_migration/javascript_buttons_to_lightning_actions

 

https://help.salesforce.com/articleView?id=lcc_javascript_buttons_overview.htm&type=5

 

This button does not even show for me to convert  on this page (https://lightning-configuration.salesforce.com/javascript-buttons.xhtml

 

Don't know what else to do here, here is the code I have on this button, 

 

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

{!REQUIRESCRIPT("//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js")}

 

function addOnClicks() {

$('.sowButton').click(function() {

generateSOW($(this).attr('docType'));

});

}

 

var box;

function insertScript(){

box = new SimpleDialog("hersh"+Math.random(), true);

parent.box = box;

box.createDialog();

box.setWidth('20%');

 

if ('{!$Profile.Name}' == 'Solution Engineer' || '{!$Profile.Name}' == 'System Administrator' || '{!$Profile.Name}' == 'Professional Services') {

box.setContentInnerHTML('<div><center><p>Which type of document would you like to generate?</p><button class="sowButton" docType="pdf">Pdf</button><button class="sowButton" docType="doc">Word</button></center></div><button class="btn" onclick="window.parent.box.hide(); return false;">Close</button>');

} else {

generateSOW('pdf');

}

 

box.setupDefaultButtons();

box.show();

 

addOnClicks();

}

 

function generateSOW(docType) {

box.setContentInnerHTML('<div><center><p>Loading SOW. Please wait..</p><img src="/img/loading.gif"/></center></div>');

 

sforce.apex.execute("ZuoraDocumentGenerator","generateSOW",{quoteId:"{!zqu__Quote__c.Id}", docType:docType}, function(result) {

box.setContentInnerHTML('<div><center><p>' + result + '</p></center></div><button class="btn" onclick="window.parent.box.hide(); return false;">Close</button>');

});

}

 

insertScript();

 

Can someone able to provide me some help to convert this button to lighting action? thank you.  

0/9000