Copy-and-Paste support in SharePoint Designer 2013

jonghwal's pic

Hello, fans of SPD. I am JongHwa Lim, a Program Manager of SharePoint Designer (aka. SPD). I’d like to introduce a new feature within the workflow designer in SharePoint Designer 2013.

This new feature is the ability to Copy-and-Paste within the text-based designer. The Copy-And-Paste feature was one of the biggest asks we got for the old SPD versions. We received tons of feedback from customers saying that they had to spend far too many meaningless hours and even days to recreate logic that they had already created once. This repetitive work was commonly needed for ‘Else’ branches within If statements, and for when processes required ‘Repetition’. Well, that’s now in the past thanks to the new Copy-Paste feature.

I will explain the feature with some basic sample scenarios and then explain what is supported and what is not-supported in detail.

Note. This article contains some new workflow actions and constructs available on the new workflow platform and they will be introduced very soon via this blog and help articles. So stay tuned!!

Example – Simple Approval workflow

Let’s say that you have a SharePoint 2013 type workflow on a SharePoint 2013 server. You have to create a document approval workflow which sends out email notifications for approval/rejection events and will then copy the document to the appropriate folder depending on the approval status.

You can basically build this workflow by first focusing in on what the workflow should do when the document is approved. This is because the logic for when the document is rejected will be nearly identical. The “Document Approved” logic is shown below:

clip_image001

And the email contents would look like this.

clip_image003

Back when Copy-and-Paste was not supported, you had to basically rewrite all the logic again for the ‘Rejected’ stage, which in this case was luckily only 3 actions and 1 stage, but nevertheless was still very annoying. However, as you now know Copy-and-Paste is available in SPD 2013, you can now select the ‘Approved’ stage, press Ctrl-C and then Ctrl-V directly beneath it, which leads to this.

clip_image004

You’ll notice that the Stage title is not preserved but all of the other parameter values are preserved. You can click on the ‘Approved Documents’ link to change it to ‘Rejected Documents’, and edit the Email action to change the mail contents to reflect the ‘rejected status’ as below.

clip_image006

After you update the stage title to ‘Rejected’ and update the logic within the transition section for the ‘Wait For Approval’ stage, your completed workflow logic will look like the below.

clip_image007

So what do you think? Even in this short workflow scenario, it helped a lot. And since we support multiple-adjacent-selections, this new feature really helps to make things more convenient. You can select multiple lines of actions, steps and conditional blocks, or multiple stages, then copy and paste them into the places where you need the logic. Selected items will be highlighted in a sky-blue color as shown below.

clip_image008

Then, you can choose to use the well-known hot keys: Ctrl-C, Ctrl-V, or Ctrl-X, or use the Ribbon menu or the context menu of any selected item.

clip_image009

clip_image010

Well, now that you know we have Copy-and Paste working, you must be getting curious about some of the different scenarios Copy-and Paste opens up. I will explain several commonly asked questions regarding Copy-and-Paste below.

How about SharePoint 2010 Workflow type?

We also support copy-and-paste for SharePoint 2010 Workflow type (aka. WF3.5 type). Basically the UX will be identical whether you use WF4 workflow or WF3.5 workflow in SPD.

Let’s say you have the following workflow that only handles ‘Approved’ status.

clip_image011

After you insert an ‘else’ branch and select the two actions highlighted in blue, you can paste them right into the ‘else’ section.

clip_image013

It will result in the following logic.

clip_image014

Note: I updated the properties of the final action to reflect the proper ‘rejected’ status.

How about actions which contains lookup values to other list when they are pasted to a different site without that list?

Let’s use this example. If you paste actions which look up values in another list onto a different server, the following will happen.

Figure 1. Actions in the source server

clip_image016

Figure 2. Actions in the target server

clip_image018

If you press the ‘Check for Errors’ or ‘Publish’ button, SPD will indicate that there’s no errors, but the workflow will fail at runtime.

clip_image019

So please make sure that you clean up the look ups and update it appropriately after pasting it into a different site.

How about actions which are not allowed in the target workflow/area?

Let’s say you want to copy an action which is only meaningful in a list workflow and paste it into a site workflow. You will then see the following error or validation error when the ‘Check for Errors’ or ‘Publish’ button is pressed.

clip_image020

Paste as Text

There are cases where you want to just document the logic of your workflow. One option would be to use the Visual Designer and export out the diagram to Visio. But you can do this a lot quicker by just selecting the area you want to document, copying it and pasting it into Word or Notepad. Here is the result of the same logic used above when it is pasted into Word.

clip_image022

This is very convenient!

What is not supported

Even though we tried to enable frequently used features found within most editing tools, the following limitations should be noted:

  • There is no support for Undo (Ctrl-Z)
  • You cannot select multiple objects by clicking and dragging
  • You cannot moving selected items by clicking and dragging objects
  • Shift+Left Mouse Click can be used for multi-selection of actions but it cannot be used to select multiple constructs such as Stage, Step, or Parallel Block.
  • We also don’t support copy-and-paste across the different workflow platform types. If you try it, you will see one of following messages

clip_image023

clip_image024

  • Copy-and-paste of workflow actions in the text based designer is not fully integrated with the Clipboard so the ‘Paste’ button within the Clipboard will not work properly
  • If you try to copy-paste contents across Remote Desktop, it won’t work as we don’t support copy-paste across SPDs with different PIDs
  • The ‘Build Dictionary’ action does not keep its properties after being pasted

 

Thanks,

JongHwa

Comments

  • Anonymous
    October 31, 2012
    This is gonna reduce a lot of dev time !! especially when designing huge workflows. Also, wondering if SPD 2013 WorkflowComplexity increased with respect to the one in SPD 2010?

  • Anonymous
    February 28, 2013
    Note: if you copy (or cut) and paste a loop, it will loose it's title. All other actions/steps/etc that have titles, seem to be OK, just loops have a problem.

  • Anonymous
    September 09, 2013
    Hello JongHwa. When we copy an action from one 2010 workflow and paste the action into another 2010 workflow we are getting an error with the Activity IDs not matching during the compile process. An example of the error is: (0, 0) Activity 'ID817' validation failed: Cannot resolve Activity 'ID828'.) Checking for errors seems to display everything fine though. Any thoughts?

  • Anonymous
    September 08, 2014
    I was very excited about the new copy/paste feature but I have been experiencing very strange behavior as though code is simply being ignored and I feel like it is related to copying/pasting/moving code around.  I started keeping very detailed log messages to try to figure out if it was just some logic problems.  and what I discovered was that if I created a new step and retyped the very same instructions, they executed just fine!   I was using SPD 2013, but creating both SPD2010 and SPD2013 workflows because it seemed like certain features worked in one but not the other.  (For example, SPD2013 seemed to have erratic results when setting/testing ApprovalStatus on an item in an OOB list that was configured to require approval.)   At the time I was debugging the logic problems, I happened to be in an SPD2010 workflow.    So I can't say if the same behavior would be exhibited in an SPD2013 workflow, but I wasted so much time debugging my problems that I do not have the energy to try it all over again in SPD2013.  Many wasted hours .... Betty