Workflow conversion to BPM - URL Fields not working in BPM but do in old Workflow

Hi everyone.

I am converting one of our old workflows into the new BPM. However on this we use alt text plus a link to feed into our survey feature.

On the old workflow we do the following:

http://[URL].com/?=9&nme={::future::Opportunities::contacts_opportunities_1::first_name::}%20{::future::Opportunities::contacts_opportunities_1::last_name::}&clt={::future::Opportunities::accounts::name::}&bnd={::future::Opportunities::brand_c::}&prjnam={::future::Opportunities::name::}&prjno={::future::Opportunities::auto_number::}&mmrnam={::future::Opportunities::csd_team_c::}&oppno={::future::Opportunities::id::}

And link that into a href as follows:

<a href="http://[URL].com/?=9&amp;nme={::future::Opportunities::contacts_opportunities_1::first_name::}%20{::future::Opportunities::contacts_opportunities_1::last_name::}&amp;clt={::future::Opportunities::accounts::name::}&amp;bnd={::future::Opportunities::brand_c::}&amp;prjnam={::future::Opportunities::name::}&amp;prjno={::future::Opportunities::auto_number::}&amp;mmrnam={::future::Opportunities::csd_team_c::}&amp;oppno={::future::Opportunities::id::}">CSQ LINK</a>

However when putting this into the new BPM email templates, the link doesn't replace the fields with the data, unless I put the link outside of a link and onto the main body:

<p>http://[URL].com/?l=9&amp;nme={::future::Opportunities::contacts::full_name::}&amp;clt={::future::Opportunities::accounts::name::}&amp;bnd={::future::Opportunities::overcode_name_c::}&amp;prjnam={::future::Opportunities::name::}&amp;prjno=303521&amp;mmrnam={::future::Opportunities::csd_team_c::}</p>

This returns what I would expect - 

http://[URL]?l=9&nme=&clt=Test Company&bnd=&prjnam=testestest&prjno=303521&mmrnam=Chestnut New but it's unclickable.

The above paragraph works fine, but we want to re-use it as a <a> tag so the customers can just click. I have converted it to the "new" style as well and have the same issue:

http://[URL]/?=9&amp;nme=%7B::contacts_opportunities_1::first_name::%7D%20%7B::contacts_opportunities_1::last_name::%7D&amp;clt=%7B::accounts::name::%7D&amp;bnd=%7B::Opportunities::brand_c::%7D&amp;prjnam=%7B::Opportunities::name::%7D&amp;prjno=%7B::Opportunities::auto_number::%7D&amp;mmrnam=%7B::Opportunities::csd_team_c::%7D&amp;oppno=%7B::href_link::Opportunities::name::%7D

Can anyone help?

Thanks,

Daniel

  • Interesting, I wanted an answer for this too, since we are using Process templates more and more.

    And I found that the reason why the template replacement doesn't happen is because of Sugar HTML Cleaner - it tries to cleanup the template HTML and results in replacing our curly braces { and } with their encoded version %7B and %7D

    $this->$key = SugarCleaner::cleanHtml($this->$key, true);

    So this {::future::Opportunities::name::} gets converted to %7B::href_link::Opportunities::name::%7D


    The fix is simple, and this could be a feature request, but here it is:

    In a logic hook, just replace %7B and %7D with { and } respectively Joy

    i.e create your logic hook for pmse_Email_Templates:

    custom/modules/pmse_Emails_Templates/logic_hooks.php

    <?php

    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1,'Fix for Links in Email Template','custom/modules/pmse_Emails_Templates/FixLinksForEmailTemplate.php','FixLinksForEmailTemplate','execute',);

    And define your code there to replace the body_html: custom/modules/pmse_Emails_Templates/FixLinksForEmailTemplate.php

    <?php

    /**
    * SugarCleaner::cleanHtml cleans up template variables, but we restore them here
    */
    class FixLinksForEmailTemplate
    {

    function execute($bean, $event, $arguments)
    {
    $bean->body_html = str_replace('%7B::', '{::', str_replace('::%7D', '::}', $bean->body_html));
    }
    }

    This should just replace our template variables, so this would work for replacements, and we are free to use any links as we need!

  • and this could be a feature request, but here it is

    I think this is a good idea too - definitely recommend requesting it here: sugarclub.sugarcrm.com/.../product-suggestions

  • Why not to try solve the challenge with Logic Builder for Sugar, that extends SugarBPM?

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient