function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ching HoryChing Hory 

Buttons show hide on click ...hide permantly until 2nd button click ..for user. even if page refresh

 HI
I have two lightning buttons , One is Go Online and another is Go Home , i want that is user /sales Recp click on
Go Online button , button automatically disable and GO Home Enable .Even if the page refreshed  .. but was supposed to be Diasble Until user  click on Go Home button. 
And condition is that sales Recp / User can create only one record in a day ..
Button will disable even page refresh ... until Sales recp / User Go offline.

Thanks in advance
<div class="slds-p-top_xx-large">
     <lightning:button variant="success"  aura:id="disableGoOnline" label="Go Online"  onclick="{!c.GoOnlineMethod}" disabled="{!v.HideButtotn}"/> 
   <lightning:button variant="destructive"  aura:id="disableGoHome" label="Go Home" title="Destructive action" onclick="{!c.GoHomeMethod}" disabled="true"/>
     </div>

 
Deepali KulshresthaDeepali Kulshrestha
Hi Ching,

You can't do it through javascript if you want to hide the button permanently you have to save its value in the backend and you can achieve it throw custom setting.
create a custom setting and on click of both buttons you have to change the value of that custom setting and on behalf of that, you can show or hide your button even you refresh your page.
to create a "Custom setting" please go through the given link:-
-https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_customsettings.htm

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha