0

Scenario

We have two types of opportunities and two types of leads. The two opps are for different business processes related to the customers specific needs.

We currently have sales agents able to convert a Lead of Record Type 1 into Opps with a record type 2. This is causing problems with the customer data once the sales agent moves to the existing opp and begins the sales process.

As a result they have to create a new opportunity and change the record type manually and fix the opp that way.

We would like to use a validation rule on the opportunity to fix this problem. Here is what I have so far:

AND(ISNEW(),
NOT(Original_Lead__r.RecordType.DeveloperName = 
RecordType.DeveloperName)
)

This will fire on initial conversion, but let's say the customer needs a second opportunity of record type 2 after conversion, the rule will still fire and prevent its creation. Anyone have any suggestions?

1
  • At this point I'm thinking this is going to have to either be handled in the trigger or in a VisualForce page. Anyone else agree?
    – thinker
    Nov 4, 2019 at 19:51

2 Answers 2

1

An approach:

  • use a Process Builder to set the Lead.RecordType.DeveloperName into a text field on Lead called RecordType_DevName__c
  • Using Lead mapping rules, assign this field to an Opportunity field called Sourced_From_Lead_RecordType__c
  • Use a Process Builder on Opportunity to coerce the Opportunity recordtype to the desired record type
3
  • Just to clarify, you're saying use the ProcessBuilder then to check 'Source_From_Lead_RecordType__' and then on create of opportunity, we would set the record type to match?
    – thinker
    Nov 5, 2019 at 14:18
  • 1
    The act of lead conversion will execute DML on Opportunity so PB on Opportunity can execute and exploit any fields mapped from Lead.
    – cropredy
    Nov 5, 2019 at 15:23
  • Thanks for the info. We were able to figure it out with a workaround...posting now.
    – thinker
    Nov 5, 2019 at 15:49
0

For some reason the ISNEW() did not work. Worked with our sr. dev and we were able to get this workaround.

AND(
    NOT(ISBLANK(RecordTypeId)),
    NOT(ISBLANK(Original_Lead__c)),
    Original_Lead__r.RecordType.DeveloperName != RecordType.DeveloperName ,
    Original_Lead__r.ConvertedOpportunityId = Id,
    $Profile.Name != 'System Administrator'
)

We added the profile filter at the end in case we needed to fix leads for our agents. Thanks for the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.