Skip to main content

Hello,

 

I'm facing issues with Org-wide email addresses. I have Workflow alerts that uses Org-wide email addresses and also Apex classes that sent email using code like this email.setOrgWideEmailAddressId(System.Label.OrgWideEmailAddressId);

When pushing those components on the scratch org, workflow Alert fail. The Apex classes can deploy but test run are failing because the Org-wide email address do not exists.

 

I understand that I need to create the org-wide email address on the scratch Org and open the specified mail box and click the link to validate the address in Salesforce. The question is how to do this as part of Continuous Integration where I'm creating scratch Org on the fly and pushing code on it and then running Test classes?

 

Is somebody facing the same Issue? is there a workaround for this?

 

Any help will be highly appreciated.

 

Thanks

29 comments
  1. Oct 22, 2022, 7:47 PM

    @Patrick Fischer What is your goal here? I don't understand why you're replying with:

     

    <senderAddress>OWEA1</senderAddress>

    <senderType>CurrentUser</senderType>

    This will deploy fine to any environment, i.e.

    scratch-orgs and sandboxes

     

    and

     

    The good thing is, that the script takes & replaces

    emails by environment. Example: a) for Scratch-Org / Dev

    Sandbox it's 'CurrentUser'

     

    Unless I'm missing something obvious, both of these are misleading claims. "OWEA1" is an invalid email address and can't be deployed to any environment. And "CurrentUser" is an invalid email address and can't be deployed either.

     

    For deploying to new scratch orgs that can't have any verified email addresses set, neither of your messages seem to work. 

0/9000