Pass "Firstname Lastname" as Company Name | Community
Skip to main content
April 1, 2018
Question

Pass "Firstname Lastname" as Company Name

  • April 1, 2018
  • 1 reply
  • 4403 views

We have a client which uses Marketo forms / landing pages. On the form we take the firstname and lastname as mandatory fields however the line of business does not require a "Company Name" field. This being said Salesforce will not sync without it.

After discussing with them they would like the company name to be "Firstname Lastname".

How can we achieve this on form builder? If not possible what is the right way to achieve this?

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
April 1, 2018

<script>

MktoForms2.whenReady(function(form){

  form.onSubmit(function(form){

    var currentVals = form.getValues();

    form.addHiddenFields({

      Company: [currentVals.FirstName, currentVals.LastName].join(" ")

    });

  });

});

</script>

April 1, 2018

Thank you. Do I need to add this on the landing page as an additional script?

SanfordWhiteman
Level 10
April 1, 2018

Yes, place it just before the closing </body> tag.