Skip to main content

Hi all

I have a javascript button on  a record detailwhich is  basically updating the record (a checkbox field). I tried creating a lightning action to update the record which works fine but it is not the exact functionality I am looking for. here is the javascript button;-  Here the users are able to click the button even if they dpnt have access to the field directly. how can I achieve this in lighnting?

{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js')} 

{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js')} 

try{ 

jQuery(function() { 

/*Append the jQuery CSS CDN Link to the Head tag.*/ 

jQuery('head').append('<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.css" type="text/css" />'); 

 

/*Create the HTML(DIV Tag) for the Dialog.*/ 

var html = 

'<div id="dialog" title="Call"><p>Are you sure you want to request a call with Regional and HQ management?</p></div>'; 

 

/*Check if the Dialog(DIV Tag) already exists if not then Append the same to the Body tag.*/ 

if(!jQuery('[id=dialog]').size()){ 

jQuery('body').append(html); 

 

/*Open the jQuery Dialog.*/ 

jQuery( "#dialog" ).dialog({ 

autoOpen: true, 

modal: true, 

show: { 

effect: "", 

duration: 1000 

}, 

hide: { 

effect: "", 

duration: 1000 

}, 

buttons: { 

"Continue": function() { 

var url = "/apex/PressCallButton?id={!Inventory_Exception__c.Id}"; 

var width = "520"; 

var height = "400"; 

window.open(url, '','scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no, width=' + width + ',height=' + height + ',left=' + ((window.innerWidth - width)/2) + ',top=' + ((window.innerHeight - height)/2)); 

jQuery( this ).dialog( "close" ); 

}, 

Cancel: function() { 

jQuery( this ).dialog( "close" ); 

}); 

}); 

catch(e){ 

alert('An Error has Occured. Error: ' + e); 

}

2 commenti
  1. 31 mar 2017, 18:26
    Hi Pratima, If you like we can schedule a remote meeting to give you some guidance in how to achieve this, and why the lightning action it is not working exactly as you want.
0/9000