4

I have a custom Auth. Provider and a couple of Named Credential which use it. The auth. provider metadata requires "Execute As" field which is represented as username in metadata and as you know, usernames are globally unique in Salesforce.

So the deployment will always fail, because user will never exist on another sandbox and at the same time, the username field cannot be left empty.

What is the proper approach in this case in source driven development?

For now, I will have to run a script which replaces username when new scratch org is created and when source is deployed to staging environments. It's obviously far from perfect solution, because my teamies will have to use custom script instead of sfdx force:org:create and because the username change will be visible in VCS every time someone creates a new scratch org.

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.