Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Using a list item as a template

  Asked By: Carlos    Date: Jul 02    Category: Sharepoint    Views: 2177

I have a user who wants to add items to a list, but he wants to use an
item's existing content as the basis for the new item. In some ways,
it's like an item template rather than a list template. Does anyone
know if this is possible?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Gabriel Patterson     Answered On: Jul 02

Look into "Content Types" and see if that's what you're looking for.

 
Answer #2    Answered By: Victor Hughes     Answered On: Jul 02

I've worked with content  types a lot. And
they're not going to do what I want -- at least not as far as I know.
My client wants to use a prior list  record (with its content intact)
as the basis  for a new list record. Essentially, he wants to start a
new record that's been pre-populated with the prior record's data.
Content types just provide you with content-specific, empty meta-data
fields -- unless you default the fields with some generic text, such
as today's date, for example.

 
Answer #3    Answered By: Gordon Blair     Answered On: Jul 02

You can extend the ECB with an entry to a new page. This new page can grab the
list/item id's provided in the query string and create the new item. Then,
re-direct to the edit page for this new item.

Or, the link can go to a customized New item  page that populates the controls.

 
Answer #4    Answered By: Barry Burke     Answered On: Jul 02

I've done something similar to this using a Workflow (WF) created in
SharePoint Designer, and a tweaked version of the capability Mark
Bower talks about on his blog here -

http://blogs.msdn.com/bowerm/articles/175691.aspx

regarding the creation of customised context (drop-down) menus

What I think might work is to create a way of running a WF against
the document, and what that does is copy the document back into the
same list  with a new name either that you specify (I often use
ZZZZZZ) or it will simply stick the date and time after it. Then
still in the WF you can hunt for that name in the list, and rename it
properly (if you use the added date & time method, you can set a
hidden field on the document to be the same date & time, and then
hunt for the new document using that).

The WF can also crop out things like created by name/date etc, and
compute it back in to be the person running the WF.

The fields would all be copied through directly so that would give
you most of what you are looking for I guess.

The only itchy would be getting the WF to run, and that's why using
Mark's trick is so useful. Then you can tie it down to a particular
view if you so wish, which of course could be linked to a role or
permissions etc.

Adding a script to initiate a WF instead of the 'Hello World' Alert
that is mentioned in Mark's information is quite possible, literally
all you do is replace the line

var strAction = "alert('Hello World')";

with

var strAction = " --- your URL ---"

but you'll need to add  the following extra bit after the line of code
which is this

var strImagePath = "";

var start = strAction.indexOf("&ID=")+4
var prefix = strAction.substr(0, start)
var suffix = strAction.substr(strAction.indexOf("&", start),
strAction.length)

strAction = "location.href = '" + prefix + "162" + suffix
+ "&DocumentID=" + currentItemID + "'"

all the above goes after this line

var strImagePath = "";

and before this line

// Add our new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);

Now the tricky bit to work out is what do you put as your URL, well
that is relatively easy, in that it must be a link to an active WF
launch page (you know the one with the WF title, and Start/Cancel,
plus any Initiation fields on it). Once you've got your WF running
as you want it to, then simply use the 'Workflows' context menu to
open the Workflow options for a document, and select the new one.
When the 'Initiate' page appears, instead of starting/cancelling,
copy the page URL for the WF, and paste it into the var strAction
line - don't forget the "'s at beginning and end and then add a ' ; '
(semi-colon) to end the line.

The final thing to do in the Source code is to take the ID of the
item you have just pasted (it is identified in the URL you copied)
into my line above

strAction = "location.href = '" + prefix + "162" + suffix

in here replace the 162 with your ID number as it uses the number to
split, then bring together the 2 sides of the URL, with the actual
Document ID against which the WF is running, in the middle.

It's then testing time.

One last point, is that every time you change your workflow, it
creates a new version, which means the active URL needs to change so
so you have to go through the copy/paste routine every time. The
trick therefore is to get the WF running as you want it to start
with, then do the 'add the context menu' thing.

Please come back to me if any of this is unclear and I'll try and
explain more. I have been meaning to put this out there as a
workaround but heh, business and other things just get in the way.

 
Didn't find what you were looking for? Find more on Using a list item as a template Or get search suggestion and latest updates.




Tagged: