Recently we were working in a visual studio workflow for SharePoint online site. Here we had created a few tasks, and our requirement was that if the user clicks directly from the email from the Approve/Reject link then directly it should open the Edit form of the task.
We were using the below workflow variables to generate the Approve\Reject link.
<a href=’%TaskSpecial: TaskUrl%’><b>Approve / Reject</b></a>
The above link will open the display form when any user clicks on the Approve/Reject link.
Let us say our task list display form url is like below:
One solution we can do is we can write the below code inside a script editor web part and put inside the particular task list’s display form in SharePoint.
Or you can also put the below code inside the SharePoint master page.
Now when ever user clicks on Approve/Reject button from the email body it will open the Edit form directly.
But one problem you will face is even if you try to open the Display form in the task list itself it will also redirect to the Edit form. So the user will not be able to see the Display form ever.
To solve the issue you can pass some query string parameter in the link in the email approve/reject link and then you can check if the above string contains the particular string then only you redirect.
Basically, you can do some string operation to handle that.
You may like following SharePoint tutorials:
- SharePoint Hosted Add-in: Send Email using visual studio workflow
- SharePoint Workflow history list URL
- Customize list view using jslink SharePoint Online
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com