• SBhatia
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies

I have written a trigger to prevent the creation of new accounts, and it works fine via UI but not via Lead Convert tool. Any ideas?

I eventually will add a filter so restrict a certain set of users (by profile) to not be able to create accounts but just testing it in a simple format to see if the account creation prevention works but it is not working when new accounts get created via lead conversion process.Any ideas?

Here's my code:


 trigger PreventNewAcctCreation on Account (before insert) 
{
  for (Account act : Trigger.new)

  {
         act.addError('You do not have access to create new Accounts');
  }

}

Hi All,

I need Apex code to update a picklist field in Opportunity by copying the value of a picklist field on Account object for that opportunity record.

 

I have a 'Geo' field in Opty that should be set to the same as the 'Geo' field on the account. We cant use the forumula field for this because this field has to be editable.

 

So here's the code i am using but it is not working-

 

Can anyone help with this please. thanks.

 

public class CopyGeoClass
{
public static void CopyGeotMethod(Opportunity[] Optys)
     {
      for (Opportunity O:Optys)
        {
          O.geo__c=O.Account.geo__c;
        }
     }
}

I have written a trigger to prevent the creation of new accounts, and it works fine via UI but not via Lead Convert tool. Any ideas?

I eventually will add a filter so restrict a certain set of users (by profile) to not be able to create accounts but just testing it in a simple format to see if the account creation prevention works but it is not working when new accounts get created via lead conversion process.Any ideas?

Here's my code:


 trigger PreventNewAcctCreation on Account (before insert) 
{
  for (Account act : Trigger.new)

  {
         act.addError('You do not have access to create new Accounts');
  }

}

Hi All,

I need Apex code to update a picklist field in Opportunity by copying the value of a picklist field on Account object for that opportunity record.

 

I have a 'Geo' field in Opty that should be set to the same as the 'Geo' field on the account. We cant use the forumula field for this because this field has to be editable.

 

So here's the code i am using but it is not working-

 

Can anyone help with this please. thanks.

 

public class CopyGeoClass
{
public static void CopyGeotMethod(Opportunity[] Optys)
     {
      for (Opportunity O:Optys)
        {
          O.geo__c=O.Account.geo__c;
        }
     }
}