3 Replies Latest reply on Oct 8, 2013 11:23 AM by Michelle Tiziani

    Use of promo code unique to a lead

    Michelle Tiziani
      So I checked in the community and I couldn't any thing regarding the use of promo codes that are unique to leads.  I'm to create a program/campaign in Marketo for some leads who previously attended a lecture.  They are not a part of a campaign in SFDC or in Marketo.  But when I import their information in Marketo they will have their own unique password to access a video for either free or a special rate.  

      So the question is, how do I even associate the promo code to the leads?  There's about 20 records.  Currently in my instance of Marketo, my tokens are not working and support is working on this.  Do I create a custom field for the promo code?  Do I import the promo code and then use the promo code token for the lead?  Any suggestions?
        • Re: Use of promo code unique to a lead
          I would set a custom field to store the values, JavaScript to generate the unique codes combined with SOAP API to update the records.

          The JavaScript would be:

               var chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
               var string_length = 8;
               var randomstring = '';
               var charCount = 0;
               var numCount = 0;
               for (var i=0; i<string_length; i++) {
                   if((Math.floor(Math.random() * 2) == 0) && numCount < 3 || charCount >= 5) {
                       var rnum = Math.floor(Math.random() * 10);
                       randomstring += rnum;
                       numCount += 1;
                   } else {
                       var rnum = Math.floor(Math.random() * chars.length);
                       randomstring += chars.substring(rnum,rnum+1);
                       charCount += 1;

               SOAP API's syncMultipleLeads would update the database:

          • Re: Use of promo code unique to a lead
            I would use their {{lead.Marketo Unique ID}} token & a random string. So like WEB84{{lead.Unique ID}} so it becomes like WEB84H58fd4. //shrug// that's what I'd do. No Javascript.
            • Re: Use of promo code unique to a lead
              Michelle Tiziani
              Thanks bgomes and Adam! It's been a while since I've played around with javascript, so I might have to go with Adam's suggestion first if my tokens are finally working.  But if not, I'm just going to have to play around with the javascript.