• Tony Garand
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
Hello Dev Community!

I would like to attach Contracts to a custom object that I have created in salesforce that tracks potential artist recruits for my company. Idealy I would like to be able to convert this information into an account / contact much like a lead. Is this possible? or should I create a new lead type?

Thank you for your time.

User-added image
Hello Developer Community!

I was running this code

List<contact> contactsToChangeOwner = new List<contact>();
for(contact c:[SELECT Id, AccountId, Ownerid, Account.ownerid from contact where  AccountId != null ]){
 
    if(c.ownerid!=c.Account.ownerid){
        c.ownerid = c.Account.ownerid;
        contactsToChangeOwner.add(c);
    }
}

update contactsToChangeOwner;

for 7,780 records to change the contact owners to match the Account Owners and I recieved this error "Apex CPU limit exceeded" what changes can I make to this code to fix this? A map?
Hello Developer Community!

I am tasked with updating my company's whole database so that the contact owners match the Account owners. There are around 5k records to change and it would be taxing to go through an excel sheet and change them and re-load them via dataloader. So, I figured some code could do the trick in the Developer Console via Execute Anonymous Window. Would the code below work?

User-added image

Let me know your thoughts and thank you for your time.

Tony Garand
 
Hello Dev Community!

I would like to attach Contracts to a custom object that I have created in salesforce that tracks potential artist recruits for my company. Idealy I would like to be able to convert this information into an account / contact much like a lead. Is this possible? or should I create a new lead type?

Thank you for your time.

User-added image
Hello Developer Community!

I was running this code

List<contact> contactsToChangeOwner = new List<contact>();
for(contact c:[SELECT Id, AccountId, Ownerid, Account.ownerid from contact where  AccountId != null ]){
 
    if(c.ownerid!=c.Account.ownerid){
        c.ownerid = c.Account.ownerid;
        contactsToChangeOwner.add(c);
    }
}

update contactsToChangeOwner;

for 7,780 records to change the contact owners to match the Account Owners and I recieved this error "Apex CPU limit exceeded" what changes can I make to this code to fix this? A map?
Hello Developer Community!

I am tasked with updating my company's whole database so that the contact owners match the Account owners. There are around 5k records to change and it would be taxing to go through an excel sheet and change them and re-load them via dataloader. So, I figured some code could do the trick in the Developer Console via Execute Anonymous Window. Would the code below work?

User-added image

Let me know your thoughts and thank you for your time.

Tony Garand