Monday, June 30, 2008

Add content to SPList Item view form

Hi,

I am sure this is a shared whim to many SharePoint implementation -
You have a list of cusotmers or what not, and you want to add more information on the view item form, like so:


So basically when you view an item on that list - you will see additional information like:
* Results on that customer from google on an iframe
* Stock information for that customer
* Information from external system - showing in a frame that gets the customer ID in query string

And much much more.

Right so first thing you have to do is to learn that the list forms (edit, new and display) are actually normal web part pages, with one web part by default.

You can very easily add more web parts to that form, all you have to do is to add this to the query string of the form and you will go into edit mode of that page:
&ToolPaneView=2



Another way is to paste this into your address bar:
javascript:MSOLayout_ChangeLayoutMode(false)

I know you can use SharePoint Designer - but this is much easier and does not involve nothing more than your browser...

Now that you got into edit form of the current item - you can add any web part you want.

Inside your web part code - you can make use of the SPContext.Current.Item to get the current item that is being loaded to the form and use it to render what ever you like.

But wait!

Actually, I just finished creating a new product called "Current Item Property" that does that and more:

By adding it to a list item form or to a WCM publishing page (or to a web part page in a document library for that matter) you will be able to do almost anything you wish.

How does it work?
2 simple properties of the web part:
First - allows you to specify what fields from the current item you want to use
Second - allows you to choose how to format that information in C# syntax (using {0},{1} etc).

After you set up the information you want - this web part can either send it by connection to another web part to use (like RSS viewer as the RSS feed url) or is can simply write it to the page (when you want to create HTML from the information, or writing an iframe with changing URL).

So - lets go over what can be done with this (few examples from my customer)

We are starting with a simple list:


1 - Showing RSS information for partner


- Create a field in the list called "Stock", and set the stock ID for each partner
- Add the "Current Item Property" web part to the page


- Set it to use "Stock" field
- Set the format to a RSS URL: http://finance.yahoo.com/rss/headline?s={0}


- Add an RSS Viewer to the page


- Connect the two web parts using the RSS viewer "Get RSS URL" connection


Done!


2 - Showing Stock infromation for customer


- Create a field in the list called "Stock", and set the stock ID for each partner
- Add the "Current Item Property" web part to the page
- Set it to use "Stock" field
- Set the format to the iframe: <iframe style="WIDTH: 400px; HEIGHT: 150px" src="http://ichart.finance.yahoo.com/t?s={0}" frameborder="0"></iframe>

- Check the property "Show Content"


Done!

3 - Showing google search results for issue


- Add the "Current Item Property" web part to the page
- Set it to use "Title" field
- Set the format to the iframe: <iframe style="WIDTH: 400px; HEIGHT: 150px" src="http://www.google.com/search?q={0}" frameborder="0"><iframe>
- Check the property "Show Content"
Done!

This way it took me 5 minutes to add more content to the list items!
The product will be released soon and it will come with few format templates for: RSS, IFrames etc - this is what we are working on now: how to package it and how to use it.

If you want more information on this - email us at sales@kwizcom.com or visit http://www.kwizcom.com

Thanks, Shai.

3 comments:

Anonymous said...

WOW!!!!!!!!!!
This is amazing!
Do you have a packaged solution of this one?

thanks
Geav Rodmin

Shai Petel said...

Solution is coming up in the next few weeks.

Check our web site for upadtes
http://www.kwizcom.com

Or contact our sales for more information or how to get a beta:
KWizCom Sales

Shai Petel said...

Just an update:

"Current Item Filter" Product is ready for beta testing if you want it!

Email shai at kwizcom.com or sales at kwizcom.com