• itdept
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
I have a situation where I'd like to solve using Visualforce, but i think it's do-able with Javascript as well.  Here's the situation:

We have a couple of different record types for Leads, record type A, and record type B.  Each record type is for a different process.  We need the "Convert" button for the Lead object to have the "create opportunity" checkbox CHECKED if the lead being converted is of record type A.  We need to have the "create opportunity" checkbox UNCHECKED if the lead being converted is of record type B.  How can I override the "Convert" button using Visualforce?  I'm sure Visualforce can handle conditionals and redirect the url to the right location...

Thanks in advance!
-Frank
  • December 30, 2014
  • Like
  • 0

Received the following error in an email when I was just playing with some code in the developer console.


Apex governor limit warning email below:

----------------------------------------------------------------------------------------------

Operation: execute_anonymous_apex.Lead

By user/organization: 005A0000000ZeAg/00DA0000000JRJD

Caused the following Apex resource warnings:

Number of query rows: 35081 out of 50000

(these emails can be disabled from the user detail page for this user)

----------------------------------------------------------------------------------------------

 

My code was simply this:

 

for(Lead[] myleads : [select id, FirstName FROM Lead])
{

    system.debug(myleads.size());
}

 

My question:

If I have more than 50K rows in the Lead table, how would one be able to query the records in this table to effectively access all the records?  I don't yet have a use case, but I'd imagine that someone would need to query all records of a table for some process, and how to go about it when the records in the table exceeds that of the governor limit.

 

Thanks,

Frank

  • November 13, 2013
  • Like
  • 0

I'm working on a trigger for the Contact table.  This trigger will fire for an insert and update.  The idea behind this trigger is to set the owner of the contact to that of the owner of the account that the contact is related to.  We have an issue where leads that are converted with Rep1 as the owner, to a contact of an account owned by Rep2. My trigger below looks good, and when I print out the values to the debug console, the currentContact.Owner.Id value reflects that of the Account, but it NEVER saves the data.  What am I doing wrong?

 

Thanks in advance.

-Frank

 

 

Here's my trigger below:

 

trigger OnLeadConvertSyncOwnerToAccount on Contact (before insert, before update) {
    if (Trigger.isBefore) {       
        Set<Id> ContactIDs = new Set<Id>();
        if (Trigger.isInsert || Trigger.isUpdate){  
            for (Contact newContact : Trigger.new) {
                ContactIDs.add(newContact.Id);                
            }
            if(ContactIDs.size() > 0){
                List<Contact> ContactsToUpdate = [SELECT Id, Name, Owner.Id, Account.Owner.Id
                                                  FROM Contact
                                                  WHERE Id IN :ContactIDs];
                for(Contact currentContact : ContactsToUpdate){
                    currentContact.Owner.Id = currentContact.Account.Owner.Id;    
                }
            }
        }
    }
}

  • August 29, 2013
  • Like
  • 0

We have a series of assignment rules that assigns owner (user) to the records on the lead table as well as the account table.  We have set up account teams for users.  I was wondering if it is possible to have a workflow that sends an email to the assigned lead owner, as well as the members of the account team?

 

Thanks,
Frank

Received the following error in an email when I was just playing with some code in the developer console.


Apex governor limit warning email below:

----------------------------------------------------------------------------------------------

Operation: execute_anonymous_apex.Lead

By user/organization: 005A0000000ZeAg/00DA0000000JRJD

Caused the following Apex resource warnings:

Number of query rows: 35081 out of 50000

(these emails can be disabled from the user detail page for this user)

----------------------------------------------------------------------------------------------

 

My code was simply this:

 

for(Lead[] myleads : [select id, FirstName FROM Lead])
{

    system.debug(myleads.size());
}

 

My question:

If I have more than 50K rows in the Lead table, how would one be able to query the records in this table to effectively access all the records?  I don't yet have a use case, but I'd imagine that someone would need to query all records of a table for some process, and how to go about it when the records in the table exceeds that of the governor limit.

 

Thanks,

Frank

  • November 13, 2013
  • Like
  • 0

I'm working on a trigger for the Contact table.  This trigger will fire for an insert and update.  The idea behind this trigger is to set the owner of the contact to that of the owner of the account that the contact is related to.  We have an issue where leads that are converted with Rep1 as the owner, to a contact of an account owned by Rep2. My trigger below looks good, and when I print out the values to the debug console, the currentContact.Owner.Id value reflects that of the Account, but it NEVER saves the data.  What am I doing wrong?

 

Thanks in advance.

-Frank

 

 

Here's my trigger below:

 

trigger OnLeadConvertSyncOwnerToAccount on Contact (before insert, before update) {
    if (Trigger.isBefore) {       
        Set<Id> ContactIDs = new Set<Id>();
        if (Trigger.isInsert || Trigger.isUpdate){  
            for (Contact newContact : Trigger.new) {
                ContactIDs.add(newContact.Id);                
            }
            if(ContactIDs.size() > 0){
                List<Contact> ContactsToUpdate = [SELECT Id, Name, Owner.Id, Account.Owner.Id
                                                  FROM Contact
                                                  WHERE Id IN :ContactIDs];
                for(Contact currentContact : ContactsToUpdate){
                    currentContact.Owner.Id = currentContact.Account.Owner.Id;    
                }
            }
        }
    }
}

  • August 29, 2013
  • Like
  • 0

We have a series of assignment rules that assigns owner (user) to the records on the lead table as well as the account table.  We have set up account teams for users.  I was wondering if it is possible to have a workflow that sends an email to the assigned lead owner, as well as the members of the account team?

 

Thanks,
Frank