Created
February 16, 2015 18:22
-
-
Save karanrajs/307a0202d47c6eaebb93 to your computer and use it in GitHub Desktop.
Trigger to call the Flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger DuplicateCheck on Account (before insert,before update) { | |
for(Account acc: Trigger.New) | |
{ | |
Map<String, Object> params = new Map<String, Object>(); | |
params.put('varAccountName',acc.Name); | |
params.put('varAccountId',acc.Id); | |
Flow.Interview.DuplicateAccountCheck duplicateAccountCheck = new Flow.Interview.DuplicateAccountCheck(params); | |
duplicateAccountCheck.start(); | |
// Obtain the results | |
String returnValue = (String) DuplicateAccountCheck.getVariableValue('varReturnAccount'); | |
if(returnValue != null && returnValue != '') | |
acc.Name.Adderror('Duplicate Account Found with the same Name: '+returnValue); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment