Showing posts with label Workflow. Show all posts
Showing posts with label Workflow. Show all posts

Tuesday, July 14, 2009

How do I duplicate a list item without code?

By Roi Kolbinger - SharePoint Consultant
KWizCom Professional Services – http://www.kwizcom.com/

Did you ever wish to copy an Item to the current list several times? What is the best way to duplicate a list item? Can it be done without code?

There is an easy, effective way and no – you don't need code! Here's how:

All you need to do is to create two new columns and SPD workflow.

Step 1: Create columns

Name the first new column you create according to the number of copies you want to make. When defining the type of information that will be in the column, choose "number". This column is where you will define the number of copies you want to create.

Name the second column according to the number of copies you want, minus one. Define the type of information that will appear in this new column as "Calculated" (this gives a number which is the result of a calculation based on a different column).
The calculation we will use here will take the first column and subtract from it -1.
The formula to use for doing this is =[number of copies]-1 like so:

Step 2: Create a new workflow at the SPD

Open the site at the SPD and then create a new workflow.
Give the workflow a name and select the list from which you desire to copy the Item. Then select your workflow start options. It is best to choose: "automatically starts the workflow whenever the item is been changed". This will renew your workflow each time the item has been updated and/or edited and insure that the calculated result is always accurate.

Next, define the step of the workflow – select "Number of copies" greater the zero.

And then, define two actions:
1) Update your item: "Numbers of copies" is will be "Number of copies minus one".


2) Create a new item in the list that duplicates the columns taken from the original item. Do not include the "Number of copies" column! If you do an infinite loop will be created.



Now when you go to an item that you wish to duplicate, all you need to do is edit the item and write the numbers of copies that you want to make in the "Number of copies" column and your copies will be made! Easy and simple with no code necessary at all!

Tuesday, October 7, 2008

Adding "Contact Us" to a SharePoint site

Whether you are hosting a WSS support site, or a publishing eCommerce site hosted with MOSS WCM, a lot of times you will find the need to allow your users to contact you using a simple "Contact us" form.

Well, this cannot be more simple in SharePoint.

This is how it is done with no development at all:

Create a list named Contact Us with fields: Subject, Body, To.

the To field - can be a user field or a choice field.

If it is a choice field (like: sales / support / partnersprogram etc...) you can do a WorkFlow using SharePoint Designer workflow wizard that sends the email to the manager / mailbox address of that subject.

If it is a user field - you create a view called: MyEmails - and set the filter to show items where To=[Me], so every user gets his "emails". Then you set up alerts to all users for new items in that view so they would get an email whenever a new item was created. (or you can do the WF solution as well).

Simple, Free and Out of the box.

Users will not see the actual email address of the person they are sending the email to, and the email will be sent from the SharePoint itself - so no spam.

You can extend this solution by adding a custom "Contact Us" form to create an item in the home page (use Custom List Form in SharePoint Designer, or Item Editor Plus from KWizCom to do so).

Also - you can use SharePoint to track these issues by adding a "Status" column that the user in charge can mark as "New, Waiting for someone else, Completed", or use the WF to create a task for each issue that is assigned to someone...

Lots of ideas, the nice thing is it is all free and you can extend and improve your solution as you go along!

* If you need help with configuring such a solution, contact me as we offer online training for these subject and in 4-5 hours online training you will be able to create and manage your own solutions even if you don't have any development experience.

Shai Petel,
VP Professional Services
KWizCom

Wednesday, February 13, 2008

Register a new workflow action to wss.actions file

After creating the new action in VS using WF extentions, you will need to register it to your sharepoint server.

This is usually done by registring your action in the built in WSS.ACTIONS file.

WSS.ACTIONS file is a core file, that may be overriden in service packs or future fixes, and was not meant to be altered.

Instead, create a new file named *.actions (i.e. myActions.actions) in the same directyory as WSS.ACTIONS file, and add the following content to it:
<?xml version="1.0" encoding="utf-8"?>

<WorkflowInfo Language="en-us">
<Actions>
<Action Name="NewAction">
... definition...
</Action>
</Actions>
</WorkflowInfo>


And register your actions under tag, where you see the NewAction example.

this way you avoide editing the SharePoint core files needlessly.

Thanks, Shai.

Thursday, June 7, 2007

SharePoint Designer Deployment Issues #2

Hya all...

as time go by I encountered another annoying issue with working with SharePoint Designer and creating WSS site template.

What I had to do is define several workflows in a template site and replicate that site using an STP template file.

Apparently that every change you make to the workflow in the designer advances its version number in one of the XML files on the workflow, and when that happens you will get an error whenever you start a workflow on any site created from that template.

I found a workaround for that, opening the workflow and clicking "finish" solved that error, but to do that on every site I created on automation? I don't think so.

Well, the guys at Microsoft were kind enough to find a more usable solution for that. Apparently all I have to do before I save the site as a template is to reset the version number to 1:
· Open the .wfconfig.xml file for every workflow in your ‘workflows’ folder
· Edit the ‘RulesVersion’ attribute to have a value of “V1.0”
· Deploy the site template

(With thanks to Jordan Hull)

This seems to solve the problem for good and not all workflows are working as I expected!

Hooray!

Sunday, May 27, 2007

SharePoint Designer Deployment Issues

Hi All,

Many of you may already noticed (the rest are in for a big surprise) that when creating team sites while using SharePoint Designer there are several issues that prevent saving the site as a template and creating sites from it.

When you are using a Data View Web Part (DVWP) or the Workflow Designer, your sites created from the template will show a generic error and will ask you to open and fix the problem using SharePoint Designer.

For example, if you are adding a list view web part and right click->convert it to xslt data view web part it will work fine. But if you used the "Data view" menu at the top -> insert data view and then connected it to a list/library - your DVWP will throw this error when saving it as a site template.

After much searches for a solution the WCM dev team came up with a solution that explained the reason for this problem.

Apparently when you are creating any list references (for example: lookup field, dvwp on a list, workflow etc) all list references are represented as the list's GUID.

When saving a site as a template the GUID is marked for replacement on all new sites created from this template. After creating a new site from that template all marked GUIDs are replaced with the new GUIDs of the new lists on the new site.

So - where is the problem? Apparently in very few cases the list GUID is stored as ListID=GUID, and not as it should be - ListID= {GUID}. When the GUID is not wrapped in {} the SharePoint replace mechanism does not recognize the list id and does not mark it for replace...

The fix for this is rather easy, after adding a WF or a DVWP all you have to do is to dive in the ASPX or XML and wrap all GUIDs with {}...

Believe it or not - this actually saves the day and things are starting to work!!!

There are talks of fixing it in service pack (SharePoint or Designer? don't know...) but for now this is the only way I know of.

Hope this helps you guys; it sure did take a lot of my time finding this solution so I'd thought I'd share...