Generating Merge T ags from an Export Definition

So I've been working on my Bee Integration with CRM/BBIS and I've got it working pretty well.  The only thing is, I have to hard code the merge tags in a stored procedure, and I do this by opening a BBIS email, going to insert merge tags, and hten copying all the img tags that show up


This works but I have to update the stored procedure that generates the merge tags for the Bee Editor every time I create a new export definition or modify an existing one.


So I started fiddling around with some SQL to generate the appropriate HTML for the merge tags and I'm SO CLOSE!


Here's an example of one that works... my root query is "Constituents" of course and I've aliased the second level node as "Bio"


<img src="/insertField.field?id=CnsBio_BBIS_LASTLOGIN&amp;name=Bio.BBIS Last Login&amp;nmode=0" fieldcat="308930b5-7d65-48c7-a3f4-e42d364240e2" fieldid="CnsBio_BBIS_LASTLOGIN" title="Constituents\\Bio.BBIS Last Login" runat="server" style="cursor: move;">


Here's one a level down, which I've aliased "Contact"


<img src="/insertField.field?id=CnsBioContact_MOBILE_PHONE&amp;name=Contact.Mobile Phone&amp;nmode=0" fieldcat="308930b5-7d65-48c7-a3f4-e42d364240e2" fieldid="CnsBioContact_MOBILE_PHONE" title="Constituents\\Bio\\Contact.Mobile Phone" runat="server" style="cursor: move;">


In this case, the correct field ID is CnsBioCont_MOBILE_PHONE with my Alias being cut to just "Cont" instead of "Contact"


Meanwhile, also at that level, I have a query that returns some giving merge tags, and it generates this:


<img src="/insertField.field?id=CnsBioGiving_FY_AMOUNT&amp;name=Giving.Current FY Giving&amp;nmode=0" fieldcat="308930b5-7d65-48c7-a3f4-e42d364240e2" fieldid="CnsBioGiving_FY_AMOUNT" title="Constituents\\Bio\\Giving.Current FY Giving" runat="server" style="cursor: move;">



Again, this is wrong, but unlike the Contact which was abbreviated with 4 characters, Giving was abbreviated with THREE characters... ie, CnsBioGiv_FY_AMOUNT


Now, those abbreviations are not defined in the export definition, so I'm struggling to figure out where they're coming from.  I need to be able to do this if I'm gonig to successfully generate merge tags for use in the Bee editor.


Thoughts?

 

Comments

  • Hmm, interesting problem!


    I don't know what kind of access you have with the code; or whether SQL allows string manipulation, but is it possible to remove the leading junk and keep only the field name?


    Ie. for CnsBioCont_MOBILE_PHONE, you would remove the leading characters; change MobilePhone to CamelCase, and keep anything after the last underscore
    CnsBioCont_MobilePhone


    Then you could match fields on MobilePhone and ignore the preceding? This is how I clean the headers in my export definitions when I export them from the system
  • Stewart Bisset:

    Hmm, interesting problem!


    I don't know what kind of access you have with the code; or whether SQL allows string manipulation, but is it possible to remove the leading junk and keep only the field name?


    Ie. for CnsBioCont_MOBILE_PHONE, you would remove the leading characters; change MobilePhone to CamelCase, and keep anything after the last underscore
    CnsBioCont_MobilePhone


    Then you could match fields on MobilePhone and ignore the preceding? This is how I clean the headers in my export definitions when I export them from the system

    Unfortunately , that won't work because the <img> tag that BBIS uses for the merge t ags needs to be exactly as it expects them to be.

     

Categories