Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

msdyncrmWorkflowTools String Function

  • 1.  msdyncrmWorkflowTools String Function

    TOP CONTRIBUTOR
    Posted Sep 11, 2019 11:53 AM
    This is a little CRM related but mostly workflow tool solution related.  Any help is appreciated.

    I'm trying to use the string function in the solution.  I want to pull out the first 13 characters following the first occurrence of ABCD in the Case Title.  I just can't figure out what the setting in the step should be, especially the regular expression.

    Can anyone help?  I've been searching and trying different expressions but can't seem to get remotely close.  Is there better documentation on the workflow tools that is hiding some where?

    Again, any help is appreciated.

    Thanks,




    ------------------------------
    Jim Corriveau
    A.W. Chesterton Company
    Groveland MA
    ------------------------------
    Conference-CRMUG_200x200


  • 2.  RE: msdyncrmWorkflowTools String Function

    Posted Sep 12, 2019 05:09 AM
    Hi Jim
    I think you are going to have to do this as a set of individual steps.

    Step 1 = String including ABCD
    Step 2 = get rightmost 13 characters of item calculated on step 1

    So
    Step 1, Capitalize all words should be true. leave everything else as default except Regular Expression which should be (ABCD)(.*)
    Step 2. Input Text = Result of step 1, Substring start = 3, Substring length = 13

    Enjoy





    ------------------------------
    Paul Smith
    SSAFA
    London
    ------------------------------

    Conference-CRMUG_200x200


  • 3.  RE: msdyncrmWorkflowTools String Function

    Posted Sep 12, 2019 08:47 AM
    Edited by Jason Shires Sep 12, 2019 08:54 AM
    Jim,

    I ran into pretty much the same problem when trying to use this tool.   I had to substring a description down to 1,720 characters.    Here the how I setup the input properties.

    Not sure if you can see it in the image, but the Regular Expression value is: "test":"(.+?)"
    Here is the example I used: https://github.com/demianrasko/Dynamics-365-Workflow-Tools/blob/master/docs/String%20Functions.md

    Workflow Substring


    ------------------------------
    Jason Shires
    Bob Evans Restaurants
    New Albany OH
    ------------------------------

    Conference-CRMUG_200x200


  • 4.  RE: msdyncrmWorkflowTools String Function

    TOP CONTRIBUTOR
    Posted Sep 12, 2019 11:02 AM

    Hi @Jim Corriveau,

    I believe you want "ABCD(.{13})​" This is more or less off the top of my head and untested, but ABCD finds those exact letters. The parenthesis specifies that you want the grouping of what's inside of it. The "." means any character. The {13} means any character 13 times.

    I'd actually use the regex.replace activity.  The replacement value would be just "$1", meaning it will return only the first grouping, instead of the entire match.  If you don't use this, it will return the entire match, including the ABCD, which you'd then have to separate out using a second step, as suggested by @Paul Smith above. The pattern would be the regular expression of course.

    This is all assuming your case titles have only one ABCD in them. If multiple, things may get more complex.

    Not really related, but you'll note on my github I submitted a pull request to add multiline support for the regex. You can get the source code here: https://github.com/ryanperrymba/CRM-String-Workflow-Utilities.  I don't think @Jason Lattimer has had a chance to review it yet, so the multiline option is not part of the standard package yet.

    Cheers!



    ------------------------------
    Ryan Perry
    Business Systems Analyst
    Auric Solar
    ------------------------------

    Conference-CRMUG_200x200


  • 5.  RE: msdyncrmWorkflowTools String Function

    TOP CONTRIBUTOR
    Posted Sep 13, 2019 03:05 AM
    Ryan, Jason, Paul - thank you for your help.  In the end, I got it done in one step and this is what i used.


    Thanks again for everyone's help,



    ------------------------------
    Jim Corriveau
    A.W. Chesterton Company
    Groveland MA
    ------------------------------

    Conference-CRMUG_200x200


  • 6.  RE: msdyncrmWorkflowTools String Function

    TOP CONTRIBUTOR
    Posted Sep 13, 2019 09:44 AM
    Congrats. I'd have expected that would also include the ABCD in your result, as it would return the full result, not just the first grouping. Is the substring trimming the ABCD out for you?  If so, I didn't realize you could implement both the substring and the regex at the same time manner.  Learn something new every day.

    ------------------------------
    Ryan Perry
    Business Systems Analyst
    Auric Solar
    ------------------------------

    Conference-CRMUG_200x200


  • 7.  RE: msdyncrmWorkflowTools String Function

    Posted Sep 16, 2019 08:05 AM
    I'm not sure the regex is actually doing anything.   When I used the substring functionality I was forced to put something into the regex field before I could save the form.

    ------------------------------
    Jason Shires
    Bob Evans Restaurants
    New Albany OH
    ------------------------------

    Conference-CRMUG_200x200


If you've found this thread useful, dive deeper into User Group community content by role