Akhlaq khan 2008-04-24 15:32:03
i am new to workflows and sharepoint designer tool.
i have two lists in my sharepoint site (MOSS 2007), say list1 and list2.
both of these lists share some common column fields. So i designed a
workflow for list1 using sharepoint designer so that adding an item in list
1 would create an item in list2 using those similar fields. i succesfully
acheived this goal without any issue.
Now, i wanted to be able to “trace” the items in list2 added through this
workflow of list1. For this purpose, i added another column in list1 which
should keep a “reference” or URL of the item in list2. This would help me
quickly pull items in list2 right from list1. For this i tried using the
“Set field in current item” activity and from the “workflow lookup” i tried
Field: Encoded Absolute URL, Path, Server Relative URL, Title (linked to
item), URL Path
(i tried all of these fields one by one)
….and under “Find the List Item” i selected:
Value: Variable:create1 (from workflow data)
(this is the variable that contained the unique ID of the item added in
Logically, it should have worked but it didn’t 🙁 I was never able to
retrieve the URL of the item in list2 using this method unless i changed the
Value from “Variable:create1” to some hard coded value like 1 or 2 which
actually were the IDs of items already added into list. And even then, the
URL i captured like this was usless as it was not correct and had different
issues based on the selections i made on the Source Field (Encoded Absolute
URL, Path, Server Relative URL, Title (linked to item), URL Path). Here is
what i saw in the URL column of item in list1:
Encoded Absolute URL: http://[servername]/[sitename]/Lists/Issues/14_.000
Server Relative URL: [sitename]/Lists/Issues
Title (linked to item): Error occurs when adding Phase using boss account.
URL Path: [sitename]/Lists/Issues/14_.000
the value “14” here was, i think, because i tried the hard coded value of
“14” in the Value, but overall URL was very wierd and did not work. Most
interesting result was when i used “Title (linked to item)” which resulted
in a funny error message saying “Error occurs when adding Phase using boss
account.” i really wonder what that means!!! can MS actually code something
like this? 🙂
i am sorry if my post is a bit too lengthy, but i wanted to explain all what
i tried and where i failed. Can someone give me any tips on how can i
acheive my goal?
Thanks for the patience 🙂
Ishai sagi 2008-04-24 15:32:36
you shouldnt be using urls as referances.
Sharepoint lists have a column (field) of type lookup, which allows you to
select in one list an item in the other list, and keep a referance to it that
is maintained by it’s ID.
Use the lookup field, and dont try to maintain the relations with custom
means such as URL.
Developer tips for SharePoint
Akhlaq khan 2008-04-29 22:50:12
maybe i didn’t explain the reason i used URLs as reference.
My objective is to be able to quickly jump to the “related” item in list2
using a single CLICK. The problem with lookup is that both of my lists
containt hundreds of items and the lookup only provides the ability to
lookup the “titles” of the items in list2 without hyperlink. Moreover, i am
creating this hyperlink using a WORKFLOW designed in sharepoint designer.
Ishai sagi 2008-04-29 22:51:12
A link to an item is built using it’s ID and it’s list’s display form url.
I dont have it infront of me, but it looks something like this:
SPlistItem itemWeWantToLinkTo = GetTheItem();
string urlToItem = itemWeWantToLinkTo.List.Web.Url + “/” +
itemWeWantToLinkTo.List.Forms[FORMTYPE_DISPLAY].Url + “?ID=” +
if you hit a problem let me know and I will power up my virtual machine and
give you the exact code
Developer tips for SharePoint
Akhlaq khan 2008-04-29 22:51:42
thanks for the tip. but i am not sure how to use it in the workflow designer
(sharepoint designer) as it is a code-free environment 🙂
After a lot of retries, what i finally concluded was that the following
fields did not populate in the item as soon as the item was created by the
Encoded Absolute URL
Server Relative URL
Title (linked to item)
On the other hand, the ID field of the item was returning proper value using
the workflow designer without any issue. This means that i was able to
retrieve the ID of item created in list2 and populate it in a column of
newly created item in list1. But when i try to do the same for any of the
above mentioned fields, it returns blank 🙁
If all else fails, i’d finally have to open up VS2005 to write the whole
workflow from scratch but i’d prefer to use the code-free environement.