0

I have specific requirement where I have 2 different process builder - #1 , #2 on same object. The two process builder basically send out two different types of email alerts based on whether the record was created/edited by dataloader or updated using a visualforce page which has a button to invoke a batch job. When this batch job is invoked i want to run process builder #2 and when when I use dataloader I want #1 process builder to run.

My initial idea was to use a custom field which I can use in process builder criteria. By default the value of this field is false which makes process builder #1's condition to be met since I have set a condition as when field value ->is null = false run process builder #1.and process builder #2 condition has field value ->is null = true. So when I use the visualforce page which invokes a batch job I update the field as true and the process builder #2 runs, once I am finished I would like to make the field as false again so that when I load the data using dataloader process builder #1 could run.

Here my problem is when the batch job finishes and in finish() when I try to make the field back to false and do an update , process builder #1 runs since it satisfy the condition. I do not want #1 to run right away when I am updating just the field value back to false.

Is there any work around?

  • 2
    I can't help but think you're going about this the wrong way. Any time someone cooks up a solution like this, I can't help but think this might be an x-y problem. Why does it have to be so complicated? There must be an easier way to do what you're trying to do. – sfdcfox Sep 14 '16 at 4:36
  • 2
    Yea, code to send the email alerts, one for when system.isBatch() = true and one when it is equal to false. Or maybe the requirement can be handled in a completely different way altogether. Would be interesting to see what is different about the alerts when the same event is happening just by a different process – Eric Sep 14 '16 at 4:39
  • Thanks guys. I wish i can explain the whole story to you guys personally. Writing up the whole project use case was not possible. sorry. But i think if I use a field update after the email alert is sent out then it should solve my problem. – SfdcBat Sep 14 '16 at 6:54

Your Answer

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

Browse other questions tagged or ask your own question.