munchkin code checkbox | Community
Skip to main content
June 12, 2015
Solved

munchkin code checkbox

  • June 12, 2015
  • 1 reply
  • 1548 views

I am setting a true false field to "yes" through munchkin code.

The account is created in marketo; however, When I make a smart list for attribute set to true, nothing is returned. I cant set the field to search for "yes" as it auto sets the field back to true.

Please advise.

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

I think this was an issue on my side. the field is optin_newsletters, but in my code, I have it as optin_newsletter.

I fixed this and it works.

1 reply

SanfordWhiteman
Level 10
June 12, 2015

When you say, "through Munchkin code," you mean using associateLead()?

Please show the JS code you're using.

June 15, 2015

<script type="text/javascript">

jQuery.ajax({

        url: '//munchkin.marketo.net/munchkin.js',

        dataType: 'script',

        cache: true,

        success: function() {

                Munchkin.init('xyz');

                Munchkin.munchkinFunction('visitWebPage', {

                    url: '/r/thank-you', params: 'registration=1'

                });

                Munchkin.munchkinFunction('associateLead',

                    {

                        FirstName: '{{{ Session::get('lead')['first_name'] }}}',

                        LastName: '{{{ Session::get('lead')['last_name'] }}}',

                        Email: '{{{ Str::lower(Session::get('lead')['email']) }}}',

                        haierOptinExtendedWarranty: '{{{ Session::get('lead')['optin_extended_warranty'] }}}',

                        haierOptinSeasonalTips: '{{{ Session::get('lead')['optin_newsletters'] }}}',

                        haierOptinMonthlyNewsletters: '{{{ Session::get('lead')['optin_newsletters'] or 0 }}}',

                        Phone: '{{{ Session::get('lead')['phone'] }}}',

                        Address: '{{{ Session::get('lead')['address'] }}}',

                        Country: '{{{ Session::get('lead')['country'] }}}',

                        State: '{{{ Session::get('lead')['subdivision'] }}}',

                        City: '{{{ Session::get('lead')['city'] }}}',

                        PostalCode: '{{{ Session::get('lead')['postal_code'] }}}'

                    },

                    '{{ Session::get('munchkin_api_hash') }}'

                );

        }

});

</script>

Accepted solution
June 15, 2015

I think this was an issue on my side. the field is optin_newsletters, but in my code, I have it as optin_newsletter.

I fixed this and it works.