• Abid ullah
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
public class AddPrimaryContact implements Queueable {

    private Contact comingContact;
    private string state;
    
    public AddPrimaryContact(Contact record, string stateabbrivation){
        this.comingContact = record;
        this.state = stateabbrivation;
    }
    
    public void execute(QueueableContext qcon){
        
        List<Account> allAccounts = [SELECT id,Name,(SELECT FirstName,LastName,Id from contacts) from Account
                                     where BillingState=:this.state limit 200];
        List<Contact> contactToUpdate = new List<Contact>();
        
        for(Account acc:allAccounts){
            
            Contact c = this.comingContact.clone();
            c.AccountId = acc.Id;
            contactToUpdate.add(c);
        }
            
        if(contactToUpdate.size()>0){
            system.debug(contactToUpdate);
            update contactToUpdate;
        }
    }
}

and in the execute window:

Contact aContact = [select id,FirstName,LastName from Contact where Id=:'0035f000009OGaqAAG'];
AddPrimaryContact checking = new AddPrimaryContact(aContact,'NY');
system.enqueueJob(checking);

and give error.User-added image
hi every one,
i am facing the above issue while deployee my code to org.
first i  create an org for lightning component challenges so there in dev hub i enable the options.User-added imageUser-added imagebut they give below error
User-added imageAny solutions?
NOT(

     OR(
   
    Country  = 'US',
    Country  = 'USA',
    Country  = 'United State of America',
     ISBLANK(Country) 

     ) 

     )  
     
 AND(
     LEN(State)= 2,
     CONTAINS(State, "AB"},
     CONTAINS(State, "CD"},
     CONTAINS(State, "EF"}
)
NOT(

     OR(
   
    Country  = 'US',
    Country  = 'USA',
    Country  = 'United State of America',
     ISBLANK(Country) 

     ) 

     )  
     
 AND(
     LEN(State)= 2,
     CONTAINS(State, "AB"},
     CONTAINS(State, "CD"},
     CONTAINS(State, "EF"}
)