In using the form.vals function for external forms, I was under the impression that it would use the REST API field names since it's a REST API. To get the function to work correctly, the SOAP field names need to be used. This is doin' me a confuse...can someone clarify why a REST API would use SOAP naming?
Here's an example of working code:
form.vals({"Phone":"{{lead.Phone Number}}",
"FirstName":"{{lead.First Name}}",
"LastName":"{{lead.Last Name}}",
"Company":"{{company.Company Name}}",
"Email":"{{lead.Email Address}}",
"State":"{{lead.State}}",
"Title":"{{lead.Job Title}}",
"City":"{{lead.City}}",
"Address":"{{lead.Address}}",
"PostalCode":"{{lead.Postal Code}}"
});
And here are the field names, as exported:
REST API Name | SOAP API Name | Friendly Label |
firstName | FirstName | First Name |
lastName | LastName | Last Name |
company | Company | Company Name |
Email Address |
state | State | State |
title | Title | Job Title |
phone | Phone | Phone Number |
(Etc)
Solved! Go to Solution.
The client-side Forms API isn't a REST API.
Here is a cheat sheet for which field name to use: