SOLVED

Re: Need help mapping form fields

Go to solution
Anonymous
Not applicable

Need help mapping form fields

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!

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Need help mapping form fields

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

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

View solution in original post

4 REPLIES 4
Josh_Hill13
Level 10 - Champion Alumni

Re: Need help mapping form fields

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?

Anonymous
Not applicable

Re: Need help mapping form fields

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
Level 10 - Community Moderator

Re: Need help mapping form fields

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

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

Anonymous
Not applicable

Re: Need help mapping form fields

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