• PrashantN
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Hi,

I have a requirement of populating the campaign owner in the new opportunities page only when, the Primary Campaign Source selected in the opportunity is of TYPE=123. More details:

1. A new campaign is created and saved with TYPE=123 and NAME=XYZ using Campaign --> New Campaign
2. A new opportunity is created as Opportunities --> New, select the Primay Campaign Source = XYZ

Now I need to auto-populate a custom field let us say "Campaign.Initiator" within the Opportunities screen only when the Primary Campaign Source = XYZ (which is of TYPE=123).

 

This Campaign.Initiator must be the owner of the Primary Campaign Source (aka the owner / creator of "XYZ" Campaign)

Any hints?

FYI: The Campaign.Name and Campaign.Type are standard SF fields.

Hi

I have trigger that needs to be run only once. The trigger would change the owner of a case based on the status the user chooses for the Case.Status meaning Case.Owner would assinged to the user  choosing Case.Status="Research/Follow Up". My code is

 

// Class Declaration
public class RecursionBlocker{
   public static Boolean flag = true;
}

 and the associated Trigger is

Trigger CaseStatusResearchFollowUp on Case (after update) {
   if(RecursionBlocker.Flag = true){
           RecursionBlocker.Flag = false;
          for(Case c :trigger.new) {
    if( ((String)c.Status) == 'Research/Follow Up' ) c.OwnerId = UserInfo.getUserId();
    }
    }
}

What happens is that the trigger runs for the first time correctly. Whenever a user visit the case and tries to unlock it, the trigger fires again and assigns the user unlocking the case as its owner.

How to prevent the trigger not to fire again when the user is just unlokcing the record and not editing / changing anything within the case?

Hi

I have trigger that needs to be run only once. The trigger would change the owner of a case based on the status the user chooses for the Case.Status meaning Case.Owner would assinged to the user  choosing Case.Status="Research/Follow Up". My code is

 

// Class Declaration
public class RecursionBlocker{
   public static Boolean flag = true;
}

 and the associated Trigger is

Trigger CaseStatusResearchFollowUp on Case (after update) {
   if(RecursionBlocker.Flag = true){
           RecursionBlocker.Flag = false;
          for(Case c :trigger.new) {
    if( ((String)c.Status) == 'Research/Follow Up' ) c.OwnerId = UserInfo.getUserId();
    }
    }
}

What happens is that the trigger runs for the first time correctly. Whenever a user visit the case and tries to unlock it, the trigger fires again and assigns the user unlocking the case as its owner.

How to prevent the trigger not to fire again when the user is just unlokcing the record and not editing / changing anything within the case?