[SalesForce] URL to login and pre-populate more than one field

I need to launch SalesForce URLs from a non-SalesForce app to get things done. I can easily launch to login:
h++ps://login.salesforce.com?un=myname@mycompany.com&pw=mypass

And once logged in, I can launch another URL to populate 3 fields.
h++ps://na15.salesforce.com/003/e?con13=8887230515&name_lastcon2=Unknown&con10=18667230515

Both of these work just fine. But I want to do both operations. I have found that I can use this to login and populate one field:
h++ps://login.salesforce.com?un=myname@mycompany.com&pw=mypass&startURL=https://na15.salesforce.com/003/e?con13=8887230515

But when I try to do anymore than one field – only the first field is populated.
h++ps://login.salesforce.com?un=myname@mycompany.com&pw=mypass&startURL=https://na15.salesforce.com/003/e?con13=8887230515&name_lastcon2=Unknown&con10=18667230515

Is there a way to launch one URL that will login, redirect to a new Contact page and pre-populate more than 1 field?

Thanks – Scott

Best Answer

If you URL encode the start URL, then it will fill all fields. Note that you don't need to hard code the instance (na15.salesforce.com). A relative URL works just fine.

startURL=%2F003%2Fe%3Fcon13%3D8887230515%26name_lastcon2%3DUnknown%26con10%3D18667230515

Note that there is a security risk with passing the username and password in the URL. Instead, your app should login to Salesforce, get a sessionid and then pass that and the retURL to frontdoor.jsp.

Related Topic