0

I added a new feature and inside FeatureActived wrote following code to open my custom task form whenever user clicks on task title.

SPContentType myTask = web.ContentTypes["Workflow Task"];  
myTask.EditFormUrl = "_layouts/mytask.aspx";  
myTask.DisplayFormUrl = "_layouts/mytask.aspx";  
myTask.Update(true);

This code is working fine. Problem is I want to revert to default out of the box form but even if I comment these lines and re-deploy solution OR disable feature in "site collection features" OR retract solution, clicking on task title still takes the user to my custom form.

How can I revert to default form?

  • 1
    Write the same code in the feature deactivated event. However, update the Eidt and Display Form Urls with default values. – Nadeem Yousuf May 3 '18 at 8:24
  • Yes, I was thinking about it but the question is what are default values? – Frank Martin May 3 '18 at 8:25
  • 1
    I don't remember. But you can try to find those in a new site collection. – Nadeem Yousuf May 3 '18 at 8:28
  • Ok on feature deactivation I simply wrote myTask.EditFormUrl = "" and it fixed the issue. Thanks. – Frank Martin May 3 '18 at 8:29
  • ok, great...... – Nadeem Yousuf May 3 '18 at 8:29
1

Please try the following PowerShell to reset the values:

Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb "http://sharepointurl"
$ct = $web.ContentTypes["Workflow Task"]
$ct.DisplayFormUrl = $null
$ct.EditFormUrl = $null
$ct.Update()
$web.Dispose()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.