You need to sign in to do that
Don't have an account?
Paul Brainard
Javascript button conversion to lightning
What is the best way to convert the following button in Classic to a Lightning component (or other option):
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
var newRecords = [];
var IR = new sforce.SObject("Incident_Report__c");
IR.id ="{!Incident_Report__c.Id}";
IR.Generate_Incident_Report__c = 1;
newRecords.push(IR);
result = sforce.connection.update(newRecords);
alert("Incident Report:\nPlease refresh the page if you do not see the new Incident Report document created under Notes & Attachments");
window.location.reload();
Please, and thank you!
Paul
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
var newRecords = [];
var IR = new sforce.SObject("Incident_Report__c");
IR.id ="{!Incident_Report__c.Id}";
IR.Generate_Incident_Report__c = 1;
newRecords.push(IR);
result = sforce.connection.update(newRecords);
alert("Incident Report:\nPlease refresh the page if you do not see the new Incident Report document created under Notes & Attachments");
window.location.reload();
Please, and thank you!
Paul
the best way is lightning component, create a quick action on your record detail page and use following lightning component :
apex class for lightning component : NOTE :CHANGE youObjectName__c WITH YOUR MAIN OBJECT API NAME IN APEX CLASS
lightning component : javaScript controller:
for reference : http://sfdcmonkey.com/2017/04/16/add-lightning-component-lightning-action/
Kindly let us know if it helps you, & close this query by selecting best answer if you got your solution,so this will helps other in future
http://sfdcMonkey.com