13

I retrieved a Named credential using Ant migration tool and in the xml it looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<NamedCredential xmlns="http://soap.sforce.com/2006/04/metadata">
    <endpoint>https://prodbox-dev.herokuapp.com/v1</endpoint>
    <label>prodbox_heroku</label>
    <principalType>NamedUser</principalType>
    <protocol>Password</protocol>
    <username>[email protected]</username>
</NamedCredential>

when i deploy the same using ant, it gives error for password. Due to this i have to go and manually create a named credential as a pre-deployment activity. Can password be also set in this xml and deployed using Ant ?

1

1 Answer 1

29

adding password manually after retrieve and before deploy worked :

<?xml version="1.0" encoding="UTF-8"?>
<NamedCredential xmlns="http://soap.sforce.com/2006/04/metadata">
    <endpoint>https://prodbox-dev.herokuapp.com/v1</endpoint>
    <label>prodbox_heroku</label>
    <principalType>NamedUser</principalType>
    <protocol>Password</protocol>
    <password>actual_password</password>
    <username>[email protected]</username>
</NamedCredential>
1
  • 1
    The location of the <password> tag matters for my case. I had to put it before <username> like in your sample above.
    – Fer
    Mar 19, 2021 at 6:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .