0

I'm using data loader to update a few hundred records (opportunities), I'm moving what account the opportunities are related to. In doing so, the opp names are being automatically updated/mirrored to the account they're now being related to, which I do NOT want it to do, I'd like them to keep their names, does this seem strange?

I checked for WFR thinking there was something there doing this, nadda, checked process builder as well, nothing there either even remotely close.

I've done a few different upload tests, one with mapping the opp name as a field, and one without mapping the opp name, in theory meaning both ways should be keeping the same name.

What in the world am I doing wrong?

Generic trigger interfaces for the Opportunity object. See the OpportunityTriggerHandler and OpportunityUtils classes for implementation.

trigger OpportunityTrigger on Opportunity(after delete, after insert, after undelete, after update,
before delete, before insert,           
before update) {

OpportunityTriggerHandler handler = new OpportunityTriggerHandler();

// before insert
if (Trigger.isBefore && Trigger.isInsert) {
    handler.OnBeforeInsert(Trigger.new);
}

// after insert
if (Trigger.isAfter && Trigger.isInsert) {
    handler.OnAfterInsert(Trigger.new, Trigger.newMap);
}

// before update
if (Trigger.isBefore && Trigger.isUpdate) {
    handler.OnBeforeUpdate(Trigger.old, Trigger.oldMap, Trigger.new, Trigger.newMap);
}

// after update
if (Trigger.isAfter && Trigger.isUpdate) {
    handler.OnAfterUpdate(Trigger.old, Trigger.oldMap, Trigger.new, Trigger.newMap);
}

// before delete
if (Trigger.isBefore && Trigger.isDelete) {
    handler.OnBeforeDelete(Trigger.old, Trigger.oldMap);
}

// after delete
if (Trigger.isAfter && Trigger.isDelete) {
    handler.OnAfterDelete(Trigger.old, Trigger.oldMap);
}

// after undelete
if (Trigger.isUnDelete) {
    handler.OnUndelete(Trigger.new);
}

}

The OpportunityTriggerHandler apex code should be below:

Implementation class for the generic Opportunity trigger methods.
public with sharing class OpportunityTriggerHandler {

public void OnBeforeInsert(Opportunity[] opportunities) {

}

public void OnAfterInsert(Opportunity[] opportunities, Map<Id, Opportunity>opportunitiesMap) {

}

public void OnBeforeUpdate(Opportunity[] oldOpportunities, Map<Id, Opportunity> oldOpportunitiesMap, 
                           Opportunity[] newOpportunities, Map<Id, Opportunity> newOpportunitiesMap) {
    OpportunityUtil.changeOpportunityAccount(oldOpportunitiesMap, newOpportunitiesMap);
    OpportunityUtil.updateContactRoleStage(newOpportunities);
}

public void OnAfterUpdate(Opportunity[] oldOpportunities, Map<Id, Opportunity> oldOpportunitiesMap, 
                          Opportunity[] newOpportunities, Map<Id, Opportunity> newOpportunitiesMap) {

}

public void OnBeforeDelete(Opportunity[] opportunities, Map<Id, Opportunity> opportunityMap) {

}

public void OnAfterDelete(Opportunity[] opportunities, Map<Id, Opportunity> opportunityMap) {

}

public void OnUndelete(Opportunity[] opportunities) {

}

}
13
  • You mentioned that you have checked WFR/PB but not code?
    – Girbot
    Commented Jul 17, 2018 at 18:58
  • 1
    Verify if you have a trigger on Opportunity which most likely is generating the names as you see.
    – Jayant Das
    Commented Jul 17, 2018 at 19:01
  • @Girbot are you referring to some sort of Apex stuff? If so, I haven't, but I certainly haven't added anything there as its over my head, and I'm the only one who would have ever added something as I'm the only "pseudo" admin. That being said others certainly have had their hands in the org before, there's always the possibility I wasn't aware of something and I'm down to check ANYTHING, this is driving me nuts! Commented Jul 17, 2018 at 19:02
  • 1
    @DevinPearman - if you can post the relevant snippet from the trigger, that will help to identify, if that's what is causing this name change. Also please note, any trigger written on any object is always custom written and not included as part of any standard OOTB offering.
    – Jayant Das
    Commented Jul 17, 2018 at 19:16
  • 1
    @DevinPearman - Request you to edit your post and add the OpportunityTrigger code details out there. Based on what you have mentioned in the comment, to be able to take a look, we would at least need to also see OpportunityTriggerHandler class as well.
    – Jayant Das
    Commented Jul 17, 2018 at 20:16

0

You must log in to answer this question.

Browse other questions tagged .