in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

using workflow to set a field equal to the url of the original list.

Last post 10-03-2008 4:27 PM by jimboling. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 10-25-2007 1:28 PM

    using workflow to set a field equal to the url of the original list.

    Here is what I'm trying to accomplish.  I'm trying to create a workflow that runs when a new item is added to the list.  The workflow creates an item in another list.  I want one of the fields in the new list to contain a link to take us back to the original item.

     Here is what I've been trying.  (all in sharepoint designer btw.)  If been trying to use html to set the fields value.  I've been using this code.  <a href="http://intranet.webpage.com/sharepoint/originallist/dispform.aspx?id=[%receivinglist:ID%]>Link to Source item<a/>

     The end result creates a hyperlink but it doesn't encode the [%receivinglist:ID%].  It just says the hyperlink is exactly what I have in the href.  How can I make this work?  I just want a link in the new item to take us back to the old.

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
    Filed under: , ,
  • 10-25-2007 1:54 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    I use these to make a couple links in an email I send out to a group:

    <a href="[%receivingList:Encoded Absolute URL%]">Document</a>

    <a href="http://intranet.webpage.com/[%receivingList:Path%]" mce_href="http://intranet.webpage.com/[%receivingList:Path%]">Library</a>

    I haven't tried setting them as field values in a list ...yet.  I sort of like that idea though...

    <time passes />

    Ok.  Tried it with the Update List Item action, in a workflow that runs from the original list when it is submitted, and set a field (of type hyperlink) equal to the new lists Encoded Absolute URL field, linked on my ID number what is unique to my list.  Seemed to be A-OK.

    hth,

    Steve

  • 10-25-2007 3:59 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    I had tried using the encoded absolute url and the path fields also.  I've tried setting the field to basically just be equal to the encoded abolute url.  My problem with that is I don't get a valid link.  It always ends with something like 12.000 or 6.000.

     Also if I try to put the field in the url as [%receiving list:Path%] or [%encoded Absolute URL%] it doesn't return the field in the link.  It still uses the exact text.

     Did you try this using sharepoint designer or visual studio?

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
  • 10-26-2007 7:14 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Sharepoint Designer.  Is the field you are dumping this into a Hyperlink field?

  • 10-26-2007 9:17 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Actually it was to a rich text box.  But I just tried it to a hyperlink field and I'm getting the same result.  I'm using the create a list item function, I'm selecting the hyperlink field as the one I want to set, From here I'm trying a couple of things.

     I tried just clicking the Fx button and just selecting Absolute Encoded URL.  I get this result:

    http://intranet.sharepoint.com/Lists/orignalList/27_.000

     I tried clicking on the ... button and putting in the address at the bottom.  I type in http://intranet.sharepoint.com/[%path%].  The result I get is

    http://intranet.sharepoint.com/[%25Path%25]

     

    Not sure what else to try.  Thanks for your help.

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
  • 10-26-2007 9:39 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Have you tried building a variable using a dynamic string and then inserting the variable?

    Try this:

    1. Create a new action to build a dynamic string and assign it to a string variable
    2. Use the assigned variable in your create list item action

    This is how I build complex email messages and rich text fields for use in other areas of my workflow. I usually create the variables in a separate step so I can easily go back and change them as needed.

  • 10-26-2007 11:33 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Created a variable string.  Added  the workflow step to set the variable value.  Put in http://intranet.sharepoint.com/Lists/originallist/DispForm.aspx?ID=[%OrigID%]

     In the second list the hyperlink comes up exactly as above.  It doesn't actually put in the ID Variable.

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
  • 10-26-2007 1:37 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    I just made a Custom list on my site called expensiveList, with the columns Item (inherited, Single line of text) and expenseLink (Hyperlink).

    In my workflow on my Forms list (employeeExpenseReport), when it is submitted, the workflow (in Sharepoint Designer), copies it to the employeeExpenseReportApproval Forms list, emails the approvers (using that original sytax I put up), deletes the original form in employeeExpenseReport, then uses the Create Item action to create an item in the expensiveList.  The expenseLink field is filled from employeeExpenseReportApproval:Encoded Absolute URL.  It's not pretty, but it returns this:

    http://sharepoint2007/Template/Employee%20Expense%20Reports%20Approval/Information%20Technology_Sting_2007-10-31.xml

     I had to, when I clicked thefx button, select the Source (employeeExpenseReportApproval), Field (Encoded Absolute URL), then select my employeeExpenseReportApproval:expenseReportNumber field to be related to Current Item:expenseReportNumber.

     That probably didn't help at all, but it felt good typing it out.

    Steve.

  • 10-26-2007 2:47 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    first thing I noticed was that you returned the link to a .xml document (mosy likely an infopath form?) as to where I'm returning a list entry.  A document has a definative url as to where a list item has to use the dispform.aspx?ID=.  I don't know if this is why that field doesn't work, but could you see if you get the same result if going to a normal list item instead of a document library?

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
  • 10-26-2007 3:27 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Ok.  Right you are.  This worked for me:

    I created a string variable.  In a Build Dynamic String action, I set the variable = http://sharepoint2007/[%inExpensive:Path%] using the Add Lookup button to put the field name in.  Use a Create Item action to set my hyperlink field equal to my variable and I get:

    http://sharepoint2007/Template/Lists/inExpensiveList

    Which puts me into the list...

    I created a string variable.  In a Build Dynamic String action, I set the variable = http://sharepoint2007/Template/Lists/inExpensiveList/DispForm.aspx?ID=[%inExpensive:ID%] using the Add Lookup button to put the field name in.  Use a Create Item action to set my hyperlink field equal to my variable and I get:

    http://sharepoint2007/Template/Lists/inExpensiveList/DispForm.aspx?ID=6

    Which puts me into the list item...

     Steve

  • 10-29-2007 7:26 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Shoyer and Chris Quick, if by chance our paths should cross I owe you lunch.  You like chinese? Big Smile

     That works perfectly.  Thank you very much.  I used the wrong command before.  Instead of using the build a dynamic string, I used set a workflow variable.  (it was a long day)

    If you're not part of the solution, there may be good money to be made in prolonging the problem.
  • 10-29-2007 12:18 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Just glad to help! Glad it worked for you!

  • 10-31-2007 11:17 AM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Every proposed solution for this issue is to build the string another way but no matter what, you need to hard code the name of your server, for example http://sharepoint2007 or http://intranet.sharepoint.com/

     I don't want to hard code the name of the server as it is different on my dev box, plus it may change.

     Is there a lookup variable that contains the server name?

  • 10-03-2008 4:07 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    Me too. Would rather avoid hard-coding if at all possible! Any ideas? (Yikes... no activity for a year. What does that say?)
  • 10-03-2008 4:27 PM In reply to

    Re: using workflow to set a field equal to the url of the original list.

    OK - found a revision on the earlier alleged solution which actually works. I have copied a post from another site by a clever individual known as "Wayt". Note that in his solution, the /../ is a literal. At first I thought that was just an ellipsis meaning "yadda yadda" but it turns out you have to have it.:

    Wayt said:
    This approach also works to embed a link to a list item in an email generated by a workflow associated with that list:

    [Add lookup to Current Item:Name]

    The key is the /../ between the Asbolute Encoded URL and the EditForm.aspx in the hyperlink. That /../ effectively strips off the defective part of the URL (the part with .000 or whatever at the end), allowing you to tack on the name of the ASPX page you need and the ID query to the specific list item you want to link to.

    Cheers,

    Wayt
Page 1 of 1 (15 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.