Hi Naoko Saiki,
If you are accessing the Task form from email, then update the URL in the email by prefixing ?Source=<<URL to which you want to redirect the users after exiting the Task from>>. By doing so when the task from is accessed by user the URL will appear to have <<Task URL>>?Source=<<URL to redirect>>.
OR
On after load of the task form write the below JavaScript, which will update the Task From url to include the Source query string :
NWF.FormFiller.Events.RegisterAfterReady(function (){
var oldAction=document.getElementById('aspnetForm').action;
var sourceIndx=oldAction.toLocaleLowerCase().indexOf("source");
var nakedAction=oldAction;
if(sourceIndx>0 )
{
nakedAction=oldAction.substring(0,sourceIndx-1);
}
document.getElementById('aspnetForm').action=nakedAction+"&Source="+ "<<To be redirected page URL>>";
}
I hope this helps.
@Chaitra's solution is absolutely spot on, personally I use a workflow constant containing &Source=redirecturl, and it works like a charm.
Thank you!!
Please do mark it as answered.
Thank you Chaitra, Martin,
I have been trying this solution, but I cannot get it to work.
On HTML source I realized {Common:ApprovalURL}. From Assign a Task action, I could not locate "Common" on Insert Reference menu. Is this for On-Prem? I'm looking for O365 solution.
My reflink points to a unique stringer value built by NW, and if I directly append "?Source=" on my HTML, I seem to break Approval link itself and Approver's page cannot be found as a result.
Tried with ?Source= and &Source=, but the same result.
Also your JavaScript solution, where exactly I can insert on Workflow?
In 'Client click' section of Task Form button Advanced setting, I inserted the script, but this didn't work either...
Naoko-san,
In the task notification initial email options, do not use the link provided as standard. Add your own. I always do this.
Click on the chain-icon to add the link into the email. Enter the following kind of text into the boxes, using lookup or insert reference to pull in the active Nintex content (i.e. task url):
URL: {Workflow Context:Current item URL}&Source="https://www.google.com"
Hyperlink Text: Open Form
Select the URL box contents from the INSERT REFERENCE BOX:
Current item URL
.... it will be entered into the box as I have shown above.
.....I have added google.com as an example here, But I often use Curernt site URL here too (from the reference box).
I, too, hate that users loop back to the task list. It feels quite unprofessional.
I hope this helps.
Hi Naoko Saiki,
In case of O365:
- To add link with Source query string appended to the URL that is used to access the task form below highlighted Insert Link option (as suggested by shaunlub)
2. The Custom Javascript suggested needs to be placed in the Task Form settings (and not on 'Client click' section of Task Form button), it will be executed after the form is ready as the name suggests "NWF.FormFiller.Events.RegisterAfterReady".
Chaitra, Shaunlub,
Thank you for your help, and sorry for my beginner questions!
Hyperlink seemed to make so much sense, and in the hope of completing the redirect issue, I tested only to fail..
I am not sure why, but I tested Google site to be redirected to, Task Form opened as expected, completed the task, but a page is redirected to task workflow list again.
Also tested with Javascript in Form setting, but I received the message below when opening a task form. If I remove the script, the message disappears, so I don't think it is related with the app being out of date.
-Naoko
Naoko,
Please try as I show below (using & not ? in the link). This always works for me.
The Task URL was selected from:
&Source= was hand-typed
The site URL- homepage of the site was selected from:
..which produces this:
OMG, that was it!
Thank you very much for your help :-)
-Naoko