Create URL to edit properties of library document and return to library on Save/Cancel

  • 14 August 2014
  • 2 replies
  • 27 views

Badge +3

To open the EditForm.aspx  to edit properties of a Library document, the format, should be (or is when you perform this in SharePoint):

 

<Site URL>/<List Name>/Forms/EditForm.aspx?ID=<ID>&source=https%3A%2F%2F<server>%2E<domain>%2Ecom%2FList%20Name

 

I am trying to put this together in Workflows 2013 with several string-builders. For instance, one would create the variable LibraryUrl as

fn-XmlEncode({Web-URL}/{Common:ListName})

 

Another variable would hold the variable for the source page string (i.e SourceUrl). It would be assigned via several Set Variable steps

SourceUrl  = fn-Replace({LibraryUrl},':','%3A')

SourceUrl = fn-Replace({SourceUrl},'/','%2F')

SourceUrl = fn-Replace({SourceUrl},'.','%2E')

SourceUrl = fn-Replace({SourceUrl},' ','%20')

 

This is all brought together with another String-builder, and when I hover over the link in the email notification, it appears to be correct. It does navigate to the edit form, but on Save, it opens the item, which is not the desired result.

 

If I simply use a set variable step and enter the text for the source page with colons, slashes, periods and spaces represented by the escape codes it works just fine. Unfortunately we will implement this across numerous libraries and I need to automate it.

 

Any ideas would be most appreciated.

 

Cheers,

   John


2 replies

Badge +3

Nidish,

Yeah...I used the context variables for the list name and web url, and item id. The issue is that the list names do have spaces in them, and that cannot be undone. I have found that something like:

fn-XmlEncode({Common:WebUrl}/{Common:ListName})

...works for taking care of spaces.

The problem I have is that I need to replace the colon, forward slashes, and periods in the part of the URL past "&Source=". I need the ability to put the escape codes into the string. I know the codes, there is a replace function, so, it should work, one would think.

The hover links in the e-mails look correct, but they do not work. If I disable the steps replacing those characters, and hand code the variable before using a string builder to graft it to the end, the link looks the same when I hover over...but it works. To clarify, working means that it goes to the EditForm.aspx to start, then to the Library view when Save is pressed. Not working implies a 404, or opening the document when Save is pressed.

I may try changing the function from SourceUrl = fn-Replace({SourceUrl},'.','%2E') to SourceUrl = fn-Replace({SourceUrl},.,%2E)...basically removing the single quotes from the characters I am trying to replace.

[UPDATE: this did not work, though removing the quotes did not cause fn-Replace() to complain either.]

Regards,

   John

Badge +3

Nidish,

 

Solution was to use the Display form, rather than the edit form. It worked without having to specify a Source argument. I was trying to over-automate the solution. User interaction is required, so this works and is simple.

Reply