+ Start a Discussion

Can we get the record values in lightning controller like in JS ?

How to access the field values in lightning  componenet .
In java script button directly we can access values like below.
var oppty = "{!amount}";
var opptystatus = "{! .Status}";
Is there a way to get the vaues like this in Lightnig JS controlller ?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Surya,

I found this below documentation wherein they simple declared an attribute and this attribute they have accessed in the controller can you try checking this link:

>> https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_attr_values.htm

I hope this helps and in case if this helps can you please choose this as the best answer so that it can be used by others in the future.

Hi David/Anutej

Im Changing Javascript button to Lightning component .
In Javascriot i'm accessing the values like below :

var connection = sforce.connection;
var oppty = "{! CameleonCPQ__Quote__c.CameleonCPQ_OpportunityId__c }";
var opptystatus="{!CameleonCPQ__Quote__c.Opportunity_Status__c }";

var status = "{! CameleonCPQ__Quote__c.CameleonCPQ__Status__c}";

how to ge the values of the current record in lightning component.
I have to add new attribute like below?
<Aura: attribute name="opp" type="object" default="{}">

my component :
<aura:component controller="ProsAmend" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="recordId" type="Id" />
    <lightning:button variant="base" label="Base" title="Base action" onclick="{!myAction}"/>    

please help .
ANUTEJANUTEJ (Salesforce Developers) 
So I found that there is documentation regarding a way to convert javascript button or links to equivalent lightning experience alternatives, below is the link.

Can you try checking them once: https://help.salesforce.com/articleView?id=lcc_javascript_buttons_overview.htm&type=5