You need to sign in to do that
Don't have an account?

OnClick Java Script Button Convert
Hi,
I am one onclick javascript button in a custom object.
{!requireScript("/soap/ajax/26.0/connection.js")}
var deno = new sforce.SObject("Denomination__c");
deno.id = "{!Denomination__c.Id}";
var cDate="{!Denomination__c.CreatedDate}";
var name= "{!Denomination__c.Name}";
var isTransfered= "{!Denomination__c.Transfer__c}";
var isApproved = "{!Denomination__c.Approve__c}";
var message = confirm('Are you sure you want to continue? Click OK to continue.');
if(message)
{
if((isTransfered == 'true' || isTransfered == 1) && isApproved =='Yes')
{
alert('Denomination is already Authorized.')
}
else
{
//Assign the values
deno.Transfer__c= true;
//alert(deno.Transfer__c);
deno.Approve__c= "Yes";
//alert(deno.Approve__c);
//Random No Generation with Created date
var randNo=Math.floor((Math.random() * 100000) + 1);
var abmSeqNo= name+'-'+randNo;
randNo+'/'+cDate+'/'+name;
name+'/'+randNo;
if(abmSeqNo){
deno.ABM_Sequence_No__c= name.replace('E','A');
}
var r=sforce.connection.update([deno]);
window.location.reload(); //to reload the window and show the updated values
}
}
So can anyone guide me how to convert it with Lightning components and controller class.
Thanks in Advance
I am one onclick javascript button in a custom object.
{!requireScript("/soap/ajax/26.0/connection.js")}
var deno = new sforce.SObject("Denomination__c");
deno.id = "{!Denomination__c.Id}";
var cDate="{!Denomination__c.CreatedDate}";
var name= "{!Denomination__c.Name}";
var isTransfered= "{!Denomination__c.Transfer__c}";
var isApproved = "{!Denomination__c.Approve__c}";
var message = confirm('Are you sure you want to continue? Click OK to continue.');
if(message)
{
if((isTransfered == 'true' || isTransfered == 1) && isApproved =='Yes')
{
alert('Denomination is already Authorized.')
}
else
{
//Assign the values
deno.Transfer__c= true;
//alert(deno.Transfer__c);
deno.Approve__c= "Yes";
//alert(deno.Approve__c);
//Random No Generation with Created date
var randNo=Math.floor((Math.random() * 100000) + 1);
var abmSeqNo= name+'-'+randNo;
randNo+'/'+cDate+'/'+name;
name+'/'+randNo;
if(abmSeqNo){
deno.ABM_Sequence_No__c= name.replace('E','A');
}
var r=sforce.connection.update([deno]);
window.location.reload(); //to reload the window and show the updated values
}
}
So can anyone guide me how to convert it with Lightning components and controller class.
Thanks in Advance