Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Niels Lynggaard 180 posts 517 karma points
    Feb 11, 2019 @ 13:51
    Niels Lynggaard

    ParsePlaceHolders in custom workflow.

    Hi Guys.

    I'm slowly going nuts here..

    I've created a custom workflow that has a property (amongst others), "Message", that I want to parse values as normal.

    Somehow, this doesn't work! The "this.Message" property comes out as if it has allready parsed, since my property {firstName} isn't there.

    If I look at this.Workflow.Settings i can see that the property initially contains this text {firstName}.

    The record also has this property, but somehow it just isn't replaced.

    I've tried applying this.Message.ParsePlaceHolders(), and as far as I know this works used to work like a charm..

    Has something changed in relation to this? E.G are placeholders parsed "automatically" when I'm looking at the property this.Message inside my "Execute"-method?

    a bit of code:

         string withRazorView = record.ParseWithRazorView("~/views/partials/" + this.RazorViewFilePath); //does this parse placeholders as well?
     if (!String.IsNullOrEmpty(this.Message))
                    string s = this.Workflow.Settings.Where(x => x.Key == "Message").FirstOrDefault().Value; //contains the {firstName]
                    s = Umbraco.Forms.Data.StringHelper.ParsePlaceHolders(record, s); //seems to remove my placeholder
                    withRazorView = withRazorView.Replace("<!--##MESSAGE##-->", "<p>" + s.ParsePlaceHolders().Replace(Environment.NewLine, "<br />") + "<p>"); //just removes my placeholder

    I'm fairly sure this just "used to work", but somehow that isn't the case here..

  • Niels Lynggaard 180 posts 517 karma points
    Feb 11, 2019 @ 14:02
    Niels Lynggaard

    Update. Some values come out, some doesn't. There must be a pattern.

    It seems, though, that it is allready parsed, when getting this.Message.

    Thank you, great community for beeing my "coding teddybear" :)

    Will update once fixed :)

  • Niels Lynggaard 180 posts 517 karma points
    Feb 11, 2019 @ 15:26
    Niels Lynggaard

    Hmm... It seems that fields with names in more than one word doesn't really want to be replaced, even if I double-check the alias such as "navnPaaLedsager".

    I tried re-creating the form from scratch, and funnily enough, the SAME fields does come out ("name", "phone", "email") and the SAME fields doesn't come out "navnPaaLedsager"...

    I'm using forms 6.0.5 ... Anybody knows about any bugs that would cause this?

  • Anders Brohus 187 posts 458 karma points
    Feb 12, 2019 @ 07:53
    Anders Brohus

    The bugs still around in 6.0.8 which is the latest we can upgrade, without upgrading Umbraco..

  • Kwok Boon Tan 3 posts 73 karma points
    Apr 26, 2019 @ 07:18
    Kwok Boon Tan

    The bug is still around in 7.0.4. I have a peek in the code in the StringHelper class, in the ParsePlaceHolders() function, it is using field's Caption as the key of a dictionary item. I believe it should use field's Alias instead.

    Workaround for me at the moment is: Make sure the question's alias and caption are the same (Spaces in caption will be ignored and removed in ParsePlaceHolders() function). And also do not use the same caption on other questions.

Please Sign in or register to post replies

Write your reply to: