Need help mapping form fields | Community
Skip to main content
September 2, 2015
Solved

Need help mapping form fields

  • September 2, 2015
  • 2 replies
  • 1650 views

We are using ReachForce with our forms.  It identifies company industries based on company names.  If a user inputs a company name that is not on the "Industry" picklist, the "Industry_M__c" picklist is displayed. I want that value mapped to the "Industry" field.  I am using the code below.  It works, but only some of the time.  I am completely flummoxed as to what I am doing wrong.  Any thoughts?

<script type="text/javascript">

MktoForms2.whenReady(function(form) {

    //listen for the validate event

    form.onValidate(function() {

        // Get the values

        var vals = form.vals();

        //Check your condition

        if (vals.Industry_M__c !== "") {

            (vals.Industry = vals.Industry_M__c);

        }

    });

});

</script>

Thanks in advance for any help!

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

form.vals() (I prefer to use form::setValues() and form::getValues() for clarity) accepts an object.

  form.setValues({ Industry: form.getValues().Industry_M__c });

2 replies

Josh_Hill13
Level 10
September 2, 2015

Why can't you use the Industry field in there anyway and use the same picklist?


Then you could run a batch to transfer the data if you really needed.

Also, it seemed like there is something wrong with the Company Field. When I clicked Country, it tried to display a list before I had even moved to that field. Then it displayed the employee and industry fields before anything had occurred. Could you spec out what you want to have happen in more detail?

September 3, 2015

My manager informed me that she already tried that, but Industry is an account field and you can't update data on account fields.  You can do it on form submit, but not through a smart campaign. Sorry I didn't provide all those details in my original post, but I don't have anything to do with campaigns - I was just instructed to map the fields. 

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
September 2, 2015

form.vals() (I prefer to use form::setValues() and form::getValues() for clarity) accepts an object.

  form.setValues({ Industry: form.getValues().Industry_M__c });

September 4, 2015

This seems to have done the trick. All the forms submitted over the past 24 hours have had the fields correctly mapped. Thanks!