Error in Replace action

Aug 24, 2010 at 12:33 PM

The Replace action seems to have an error and is unusable:

When I added the Replace action into my SPD workflow and clicked Check for Errors, I got an error (a red exclamation mark in a yellow rectangle on the right side of the action) saying "This action has required parameters that are missing."

All parameters are filled in. I tried using string constants as parameters, and variables too. Nothing made it work.

Has anyone any knowledge how this behaves or can we expect a fix in a new version?

Sep 26, 2010 at 4:54 AM

I downloaded the source code  (first use of Mercurial - seems ok)..  Anyway, the .actions file that specifies the sentences displayed in SPD talks about two outputs for the Replace() action but only one is ever wired up.  I think this is the cause of the problem.  I'm logging to a SharePoint server now to change the .actions file on that server to see if it makes a difference.  Will advise.

Sep 26, 2010 at 5:22 AM

Makes all the difference in the world :)

Open the file C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\Workflow\SPDWorkflowStringActions.actions in notepad (or something similar).

Find the Action Name=Replace() block and replace it with

    <Action Name="Replace()"
     Assembly="SPDWorkflowStringActions, Version=, Culture=neutral, PublicKeyToken=3825586d873cffa1"
     AppliesTo="all" Category="String Actions">
      <RuleDesigner Sentence="Find any instance of the value in %2 found in %1, and replace it with %3, with the final string output to %4." AppliesTo="all" Name="Replace">
        <FieldBind Field="InParam1" Id="1" Text="Input parameter #1"/>
        <FieldBind Field="InParam2" Id="2" Text="Input parameter #2"/>
        <FieldBind Field="InParam3" Id="3" Text="Input parameter #3"/>
        <FieldBind Field="OutResult1" DesignerType="ParameterNames" Id="4" Text="Output result #1" />
        <Parameter Name="InParam1" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="InParam2" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="InParam3" Type="System.String, mscorlib" Direction="In" InitialValue="empty" />
        <Parameter Name="OutResult1" Type="System.String, mscorlib" Direction="Out" />
        <!--<Parameter Name="OutResult2" Type="System.String, mscorlib" Direction="Out" />-->

The key bit is commenting out the OutResult2 parameter.

Ensure SPD is closed.  Use iisreset to reset your IIS.  Start SPD and you should find you don't have any more publishing errors.  I haven't actually tried the code but the workflow now at least passes the static validation tests.

Oct 14, 2010 at 12:08 AM

Hi Ian,

Can you send me your .actions file so I could incorporate the correction into the WSP, etc?


- Mark

Mar 2, 2011 at 8:31 AM

Just a quick update - I've changed the .actions file in the Source Code repository to include the changes from Ian above, as well as ensure some of the other Actions in the solution also have this discrepency removed. The latest WSP published under the downloads tabs includes this change, as does the latest version of code from the Source Code tab.

- Mark