locked
SP Designer Workflow: How to Get Full URL Parth to List Item? RRS feed

  • Question

  • Hi. When a list item is changed my SharePoint Designer workflow starts and sends out an email to a group notifying them of the change. How can I provide a link back to the list item in the SharePoint site?

    From my investigation, I don't think it is possible so I am planning to use a lookup list on the site where the full URL is stored. The workflow will grab that URL then append the relative URL path to the list item on the end.

    Is that the accepted method of doing it?

    Thanks!

    McGeeky
    Tuesday, June 23, 2009 8:27 PM

Answers

  • You must be, because I use it all the time, and it works.  I don't always use it by itself, but I often use it in conjunction with either static or dynamic info from elsewhere.

    Do this as a test.  Create a workflow the action to send yourself an email.  In the body of the email, use the "lookup" button to add as many of the URL metadata elements that you can find - put each one on a different line.  Then, run the workflow manually and review the email to see what all you get.   From that, you should be able to determine your preferred starting point.
    SharePoint Architect || My Blog
    Wednesday, June 24, 2009 6:15 AM
  • Ok, here is a full Forms Services URL from one of my production forms:

    http://intranet.company.com/site/_layouts/FormServer.aspx?XmlLocation=/site/ICP%20Library/ccobb-2009-07-07T09_31_03.xml&Source=http%3A%2F%2Fintranet%2Ecompany%2Ecom%2FIS%2Fsite%2520Library%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1

    Notice my XmlLocation is just the Server Relative URL and not the entire Encoded Absolute URL and notice the Source attribute, which is what tells the browser what to do upon close.  I don't think that's required or is part of your problem, but you asked what I meant.  Your use of LastName and FirstName with underscores should not be a problem, but I do not use those and do not use underscores.  I think it's much more efficient to use username, and then I just put a hyphen between the username and the now() function when dynamically creating my filename.
    SharePoint Architect || My Blog
    Thursday, July 9, 2009 3:26 PM

All replies

  • There are several options, and it's very easy to do in SPD.  You have the encoded absolute URL that you can use and is a parameter you see when choosing "current item" in SPD.  There are also URL types, but you have to learn what they all display and go from there.  You can also use a dynamic string builder to put in the static part of the URL and combine it with the current item's ID.  Basically, go to your list and go to the view of the list item that you want others to see when you give them a link.  Take that URL and dynamically create it in SPD with a dynamic string builder so that it's always relevant to the current item. 
    SharePoint Architect || My Blog
    Wednesday, June 24, 2009 2:43 AM
  • Hi Clayton. Thanks for your reply. I have tried encoded absolute URL but I get a series of question marks displayed "??????" in the email rather than the URL.

    Am I using it incorrectly?

    Regards,

    McGeeky
    Wednesday, June 24, 2009 6:08 AM
  • You must be, because I use it all the time, and it works.  I don't always use it by itself, but I often use it in conjunction with either static or dynamic info from elsewhere.

    Do this as a test.  Create a workflow the action to send yourself an email.  In the body of the email, use the "lookup" button to add as many of the URL metadata elements that you can find - put each one on a different line.  Then, run the workflow manually and review the email to see what all you get.   From that, you should be able to determine your preferred starting point.
    SharePoint Architect || My Blog
    Wednesday, June 24, 2009 6:15 AM
  • Hi Clayton. Aha! It does work - my bad. Somehow the Absolute URL Column name had been renamed with a leading underscore!

    But now I have another issue. The absolute URL looks like this:

    https://mydomain/tax/Lists/Subsidiary/1_.000

    If I click on it I get 404 not found error. What is the correct way to use that URL?

    How can I get it to look like this?

    https://mydomain/tax/Lists/Subsidiary/DispForm.aspx?ID=1

    Thanks for your help!

    McGeeky
    Thursday, June 25, 2009 5:37 AM
  • Pretty easy, luckily!

    Create an action using Build Dynamic String.  Inside the dynamic string builder, simply type:

    https://mydomain/tax/Lists/Subsidiary/DispForm.aspx?ID=

    At the end of that, simply click "Add Lookup to Body" and for Current Item, select "ID".  It should look like this:

    https://mydomain/tax/Lists/Subsidiary/DispForm.aspx?ID=[Subsidiary:ID] or something to that effect.

    If you want it to be fully dynamic, you can do some other things.  Does Encoded Absolute URL not do anything for you?
    SharePoint Architect || My Blog
    Thursday, June 25, 2009 11:53 AM
  • Hi Clayton. Thanks yet again for your response. I feel guilty now because I have not been 100% clear in what I am trying to achieve. Your example is what I need except for one thing: the https://mydomain part needs to be dynamic not hard coded.

    My worflow is included as part of a site template, when a new site is created from the template I want the workflow to know dynamically the root URL of the site.

    The encoded absolute URL is not working for me as it returns:

    https://mydomain/tax/Lists/Subsidiary/1_.000

    If there was a way to strip out the 1__.000 part then I would be made. But I don't think SharePoint Designer supports string replacement out of the box.

    Thanks again for your input Clayton!

    Regards,

    McGeeky
    Thursday, June 25, 2009 7:09 PM
  • SharePoint Designer will limit you in that when you build a workflow as part of a site template. You need to open up the workflow in SPD for the new site and click through the wizard to save it. The Actions and Conditions will be there but they will still be associated to the birthing sites lists.
    Thursday, June 25, 2009 7:51 PM
  • Hmmm. Thanks for pointing that out Toomanyhats. Shame it doesn't associate itself with the new list. I will have to include the "workflow reconfigure" as a manual step in the user instructions.
    Thursday, June 25, 2009 10:10 PM
  • McGeeky, I think we can dynamically generate the entire URL.  I will work on it when I get home.
    SharePoint Architect || My Blog
    Thursday, June 25, 2009 10:14 PM
  • Hi I tried to dynamically generate my URL to open an InfoPath form in a browser. I was able to successfully generate the correct URL but for some reason, the last part of the URL is not hyperlinked. I am able to copy the url and paste it in the browser and have it successfully invoke the submitted form in the browser. In my URL I used the path to the former server, followed by the XML location and finally the open in browser comment as noted below. Does anybody have a clue why the whole link is not hyperlinked?

    https://Site.com/Sitecollection/list/_layouts/FormServer.aspx?XmlLocation=[%Task:Link%]&OpenIn=Browser


    PS; Clayton I hope by now you have made it home so you can help McGeeky. He has been waiting for you to get home for a few weeks now :)

    Bazin Makonnen

    Thursday, July 9, 2009 2:50 AM
  • Yeah, I respond to so many posts and test so many things that I forget a lot. Your URL above is not complete, btw, because it's missing the Source node, which tells the browser where to go after it's closed.  Of course, that URL can open the form just fine.

    Your above URL is fully-hyperlinked. Where is not hyperlinked?  In the email you're sending from SPD?  Can you show a screenshot of it or send the email to me through my Blog?


    SharePoint Architect || My Blog
    Thursday, July 9, 2009 3:02 AM
  • Clayton,

     

    Thanks for your quick feedback. The link above maybe hyperlinked but the link generated via workflow email is only partially linked. Here is what I have done

     

    In the String builder, I entered the following URL

     

    https"//company.com/sitecollection/site/documentlibrary/-layouts/FormServer.aspx?XMLLocation=[%Tasks:Link%]&openIn=Browser

     

    I then created a send email action which contained the variable name from the string builder which looks like this [%Variable: LinkForForm%]

     

    The workflow works as designed and it sends an email when a form is submitted. I have taken your advice and configured the InfoPath form to close upon submit. This did not resolve the issue. The problem I am experiencing is that the link in the email is partially hyperlinked as posted below. 

     

    Please approve

     

    https://company.com/XXXX/XXXX/XXXXX/workflowTest/_layouts/FormServer.aspx?XmlLocation=https://company.com/XXXX/XXXX/XXXXX/workflowTest/SWHWtest/lastname_ FirstName_2009-07-09T09_52_02_2009-07-09.xml&openIn=Browser

     

    Unfortunately the link generated via the work flow breaks up lastname and first name. Everything post lastname is not hyperlinked. As a result the link does not work but when copied and pasted, it works. You mentioned something about a source node. Could you please elaborate? In addition is there a way to embed the EDIT button in the contained in the XML form used to update a form generated for user input in the browser form?

     

    Thanks

     

    Bazin Makonnen

    Thursday, July 9, 2009 2:20 PM
  • Ok, here is a full Forms Services URL from one of my production forms:

    http://intranet.company.com/site/_layouts/FormServer.aspx?XmlLocation=/site/ICP%20Library/ccobb-2009-07-07T09_31_03.xml&Source=http%3A%2F%2Fintranet%2Ecompany%2Ecom%2FIS%2Fsite%2520Library%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1

    Notice my XmlLocation is just the Server Relative URL and not the entire Encoded Absolute URL and notice the Source attribute, which is what tells the browser what to do upon close.  I don't think that's required or is part of your problem, but you asked what I meant.  Your use of LastName and FirstName with underscores should not be a problem, but I do not use those and do not use underscores.  I think it's much more efficient to use username, and then I just put a hyphen between the username and the now() function when dynamically creating my filename.
    SharePoint Architect || My Blog
    Thursday, July 9, 2009 3:26 PM
  • Clayton

    Thanks. That was the problem. I changed the name function in the InfoPath form and it resolved the issue. I guess it is kind of temperamental.

    Bazin Makonnen

    Thursday, July 9, 2009 5:40 PM
  • Pretty easy, luckily!

    Create an action using Build Dynamic String.  Inside the dynamic string builder, simply type:

    https://mydomain/tax/Lists/Subsidiary/DispForm.aspx?ID=

    At the end of that, simply click "Add Lookup to Body" and for Current Item, select "ID".  It should look like this:

    https://mydomain/tax/Lists/Subsidiary/DispForm.aspx?ID=[Subsidiary:ID] or something to that effect.

    If you want it to be fully dynamic, you can do some other things.  Does Encoded Absolute URL not do anything for you?
    SharePoint Architect || My Blog

    This is the solution that worked for me.

    Thank you for your input here.
    Tuesday, July 21, 2009 6:06 PM
  • Hmmm. Thanks for pointing that out Toomanyhats. Shame it doesn't associate itself with the new list. I will have to include the "workflow reconfigure" as a manual step in the user instructions.


    Hi McGeeky,

    I was interested to know if you got the concept of including a SPDesigner Workflow in a Site template working robustly?

    Even with the Reopen and Compile again step in SharePoint designer, I seem to be getting a few buggy things happening.

    Was your experience with this OK in the end or did you have to give up on this?

    Thanks

    Ruth


    Ruth, UK
    Friday, May 28, 2010 9:29 AM
  • Hi Clayton,

    I'm having a similar issue and have not been able to resolve with your suggestions.

    I have an info path form that needs to get emailed to each user for an approval process.  I've tried every URL link but because the URL is now stored as an absolute value in sharepoint, I cannot get the correct path even if I use the correct URL + current ID, it will not open the form.

    Using the URL Path does open the form but from a http location instead of the https so when the user tries to approve the form, they get a message saying that the form is already checked out to them even though the form doesn't use checkout. 

    Help!!!

    Thursday, May 30, 2013 2:11 PM
  • I had the same question and I found a easy way to use. In SharePoint designer 2010. you can use a parameter "current item URL" when choosing "workflow context" in SPD, instead of "current item".

    Then It get what you need.

    • Proposed as answer by SamChen07 Friday, November 15, 2013 7:18 AM
    Friday, November 15, 2013 7:18 AM