none
2013 Workflow Replace String action doesn't work reliably

    Question

  • I have built a workflow that writes a field with an altered version of the ISO Formatted date

    for the workflow to run, I have a blank initiation form variable so I can wipe out characters

    I copy the the ISO formatted date to Variable1

    I then use a replace string command to replace : within the Variable1 string with my blankvariable and write that to Variable2

    I then use a replace string command to replace - within the Variable2 string with my blankvariable and write that to variable3

    finally, I write variable3 to the field where I need it.

    Problem... sometimes this works, sometimes it doesn't.  I've seen the string process through without replacing the characters...as well as watched it work.

    Is the 2013 workflow engine known to be flakey...or have issues like this?

    Observation...not part of the problem...but I believe in 2010 workflows, I used to be able to start processing against a variable, and once I did my manipulation...I could write the outcome to the same variable name to update it... maybe I'm misremembering...but I swear that used to work. 

    Wednesday, April 19, 2017 3:34 PM

All replies

  • Have set up a second test.

    first run, all the replaces worked as expected.  I was even able to rewrite the same results variable so I didn't need to write a new one after each action.

    second run...with some updates to the workflow... none of the replaces work.

    redid the workflow so all variables are explicit... and still doesn't work.

    Wednesday, April 19, 2017 4:21 PM
  • More follow up... may have found the problem area.

    In 2010, we could set an initiation form parameter  to be an empty value.

    we could then use that parameter to set fields to blank them out if we needed to.

    what I'm seeing is that the same idea doesn't work reliably within 2013 workflows.   If I set my initiation form parameter "blankvalue" to either nothing, or to a space.... the replace string workflow activity will work once...when I first build the workflow... but won't ever work again.

    so...in 2013... how does one use the replace string thing to delete certain strings within a string?

    Wednesday, April 19, 2017 4:47 PM
  • Hi CarphuntinGod,

    What strings you want to replace for the ISO formatted date?

    Please share your workflow steps so that we can test and try to reproduce your issue.

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, April 20, 2017 4:35 AM
  • I have tested this some more... if I set the BlankData initiation parameter to anything but a space or empty, the workflow will behave like it should.

    I'm trying to remove the colons and hypens from the isoformatted date so I can use it in a filename

    workflow

    initiation form parameter

    BlankData set as String, empty value.

    workflow

    set variable string workingtime to Created, ISO Format

    replace : with Blankdata in string workingtime output to working time

    replace - with BlankData in string workingtime output to working time

    I've got a workaround now where I extract the parts of the iso format date and put them back together without the colons and hyphens.... but I do want to get this figured out because I may have to use this same functionality for other purposes.

    Thursday, April 20, 2017 1:26 PM
  • Hi CarphuntinGod,

    From your description, I set the workflow as below:

    I leave the BlankData blank value and I can get the right format as below:

    Do you mean you cannot get the right format when you run the workflow second time?

    What update you set before you run second time?

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, April 27, 2017 1:28 AM
  • no changes to the record, etc... but if I trigger the workflow again, it will not replace the hyphens and colons.
    Thursday, April 27, 2017 4:11 PM