• ChrisCole
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hello!
I'm new to Apex (and develoment in general). I have inherited an org that has a trigger on a custom object called "Support Request." Support Requests (SRs) havea  look-up relationship with Opportunities (and Account). In the past, all SRs were associated with an Oppty. I am creating a new record type for SRs that, although they are associated with an account, are not necessarily assocaited with an opportunity.

The following Trigger has been in place for years to auto populate the Account ID based on the associated Opportunity but now I need to prevent it from running when the user creates a SR with my new record type (01I500000006ehC). I tried a few different things (like putting an IF statement around the whole trigger), but - since I don't really know what I'm doing and I couldn't find a similar use case on the forum, nothing worked :)

Here is the exisitng trigger :

trigger MapAccountName on Support_Request__c (before insert) {
Support_Request__c obj = Trigger.new[0];
Opportunity opp = [select AccountId from Opportunity where Id = : obj.Opportunity_Name__c]; obj.AccountName__c = opp.AccountID;
}

How do I prevent it from running for my new record type? Any help you could give would be greatly appreciated!!
Thanks,
Christine

I am having trouble pulling Opportuntiy related data into a custom formula field (Lifecycle_Phase__c) that I created in my custom Engagement object.

 

On my custom Engagement object, I have a look-up field to Opportunity. I am trying to grab the recordtype info (RecordTypeName__c - which just converts the long RecordTypeId number to the Name) and place it in the above mentioned custom formula field in Engagement named "Lifecycle Phase."

 

I wrote both a CASE formula and a nested IF formula but in both instances, all that gets pulled is the "else" variable "Cross Lifecycle."

 

I have copied both formulas below - what am I missing. I get no actual syntax errors. Any help would be greatly appreciated.

Thanks!

 

CASE(Opportunity__r.Opp_RecordTypeName__c , "Design Phase", "Design", "Transition Phase", "Transition", "Operate Phase", "Operate", "Cross-Lifecycle")

 

IF(Opportunity__r.Opp_RecordTypeName__c = "Design Phase", "Design", 
IF(Opportunity__r.Opp_RecordTypeName__c = "Transition Phase", "Transition",
 IF(Opportunity__r.Opp_RecordTypeName__c = "Operate Phase", "Operate", "Cross Lifecycle")))

Hello!
I'm new to Apex (and develoment in general). I have inherited an org that has a trigger on a custom object called "Support Request." Support Requests (SRs) havea  look-up relationship with Opportunities (and Account). In the past, all SRs were associated with an Oppty. I am creating a new record type for SRs that, although they are associated with an account, are not necessarily assocaited with an opportunity.

The following Trigger has been in place for years to auto populate the Account ID based on the associated Opportunity but now I need to prevent it from running when the user creates a SR with my new record type (01I500000006ehC). I tried a few different things (like putting an IF statement around the whole trigger), but - since I don't really know what I'm doing and I couldn't find a similar use case on the forum, nothing worked :)

Here is the exisitng trigger :

trigger MapAccountName on Support_Request__c (before insert) {
Support_Request__c obj = Trigger.new[0];
Opportunity opp = [select AccountId from Opportunity where Id = : obj.Opportunity_Name__c]; obj.AccountName__c = opp.AccountID;
}

How do I prevent it from running for my new record type? Any help you could give would be greatly appreciated!!
Thanks,
Christine

I am having trouble pulling Opportuntiy related data into a custom formula field (Lifecycle_Phase__c) that I created in my custom Engagement object.

 

On my custom Engagement object, I have a look-up field to Opportunity. I am trying to grab the recordtype info (RecordTypeName__c - which just converts the long RecordTypeId number to the Name) and place it in the above mentioned custom formula field in Engagement named "Lifecycle Phase."

 

I wrote both a CASE formula and a nested IF formula but in both instances, all that gets pulled is the "else" variable "Cross Lifecycle."

 

I have copied both formulas below - what am I missing. I get no actual syntax errors. Any help would be greatly appreciated.

Thanks!

 

CASE(Opportunity__r.Opp_RecordTypeName__c , "Design Phase", "Design", "Transition Phase", "Transition", "Operate Phase", "Operate", "Cross-Lifecycle")

 

IF(Opportunity__r.Opp_RecordTypeName__c = "Design Phase", "Design", 
IF(Opportunity__r.Opp_RecordTypeName__c = "Transition Phase", "Transition",
 IF(Opportunity__r.Opp_RecordTypeName__c = "Operate Phase", "Operate", "Cross Lifecycle")))