• Ching Hory
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
 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>

 
 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
<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"/>


 
trigger Avoidduplicateprimarycontact on Contact(before insert , before update){
    Map<ID,Contact> accountIds = new Map<ID,Contact>();
    for(Contact c : Trigger.New){
        accountIds.put(c.AccountId,c);
    }   
    for(Account acc : [Select Id , (Select Id, priority__c from Contacts) From Account Where Id IN :accountIds.keyset()]) 
    { 
        for(Contact con : acc.contacts)
        {
            if(accountIds.get(acc.Id).priority__c == 'Primary')
            {
                if(con.priority__c == 'Primary')
                {
                    con.adderror('There  is already one primary contact exists.');
                } 
            } 
        }}}

User-added image
I have custom picklist field with primary and secondary values in contact , for each account there must be one contact with primary selected and rest all  contacts will be secondary ..!!
how can i achieve this..

Thnks in advance  :)
Thnks community ..!!
trigger Avoidduplicateprimarycontact on Contact(before insert , before update){
    Map<ID,Contact> accountIds = new Map<ID,Contact>();
    for(Contact c : Trigger.New){
        accountIds.put(c.AccountId,c);
    }   
    for(Account acc : [Select Id , (Select Id, priority__c from Contacts) From Account Where Id IN :accountIds.keyset()]) 
    { 
        for(Contact con : acc.contacts)
        {
            if(accountIds.get(acc.Id).priority__c == 'Primary')
            {
                if(con.priority__c == 'Primary')
                {
                    con.adderror('There  is already one primary contact exists.');
                } 
            } 
        }}}

User-added image
I have custom picklist field with primary and secondary values in contact , for each account there must be one contact with primary selected and rest all  contacts will be secondary ..!!
how can i achieve this..

Thnks in advance  :)
Thnks community ..!!