14 Replies Latest reply on Sep 14, 2016 3:59 PM by Sanford Whiteman

    Velocity Scripts - Integrating Data From An External Database

    Osman Erzinclioglu

      Is it possible, using a Velocity script, to take a single data point in a custom data object and reach out to some external database to pull in relevant information when an e-mail is sent?

       

      For instance there’s a custom object (below) on each lead which contains a list of products of interest. A given lead has the following in this object:

       

      Product

      A

      C

      E

       

      And in an external database table (below), there’s additional data points that you’d like to include in an e-mail:

       

      Product

      Cost

      Earliest Shipping Date

      A

      1.00

      October 23, 2015

      B

      5.00

      October 27, 2015

      C

      8.00

      October 25, 2015

      D

      4.50

      October 23, 2015

      E

      2.25

      October 25, 2015

       

      Is it possible for Velocity to loop through the entries in each lead’s data object and, for each product contained in the object, pull in external data, like the cost of the product or earliest shipping date, as in the example external database table above?

       

      Or would we need to run some sort of job to update a more complete custom object (below) using the API with all the up-to-date data points immediately before releasing our e-mail:

       

      Product

      Cost

      Earliest Shipping Date

      A

      1.00

      October 23, 2015

      C

      8.00

      October 25, 2015

      E

      2.25

      October 25, 2015

       

      At which point Velocity could, presumably, access all of the data in that custom object and output that information in whatever format we choose.

       

      I read a comment by a Mr. Kenny Elkington in this thread:

      "Our velocity implementation does not support outgoing requests at runtime."

      Is this precisely what I'm asking for in the top portion of this post? An "outgoing request at runtime"?

       

      Any other clever ways to go about this? Maybe compiling each user's e-mail outside of Marketo and send to each recipient using the API?

       

      Also, how much flexibility to sort the data do you typically have? From Kristen Carmean's comment in this thread, it seemed like there's some restrictions:

      "Just to add one more thing, the Sort Tool is listed on the Marketo developer site as not supported right now."

      If that's correct, what options do we have on that front? Should we leverage the API to sort the data within our objects en masse before we release our e-mail? In this video, Julia Linker talks about disabling logging during what appears to be a pretty massive update via the API. Might that be necessary, depending on the amount of data?

       

      Any catches on the analytics side?

       

      Whew! Sorry! Long post! It's just that I'm trying to conceptualize how we might go about building something like this.

       

      Any input would be great.