No delete option on Screens

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Browsing to Administration > Issues > Screens there is no option to delete a screen, even if it was just created. In the logs the following error appear:

2013-12-19 13:24:50,513 http-bio-8080-exec-3 ERROR user 404x1557x1 4s34af 127.0.0.1 /secure/admin/ViewFieldScreens.jspa [webwork.util.ValueStack] METHOD: "deletable", exception: 
java.lang.IllegalArgumentException: Unknown workflow view 'ScreenName', or cannot find attribute 'jira.fieldscreen.id' for workflow action '1'.
	at com.atlassian.jira.workflow.WorkflowActionsBean.getFieldScreenForView(WorkflowActionsBean.java:75)
	at com.atlassian.jira.workflow.AbstractJiraWorkflow.loadFieldScreenActions(AbstractJiraWorkflow.java:474)
	at com.atlassian.jira.workflow.AbstractJiraWorkflow.getActionsForScreen(AbstractJiraWorkflow.java:458)
	at com.atlassian.jira.web.action.admin.issuefields.screens.ViewFieldScreens.hasWorkflowsIncludingDrafts(ViewFieldScreens.java:176)
	at com.atlassian.jira.web.action.admin.issuefields.screens.ViewFieldScreens.isDeletable(ViewFieldScreens.java:197)
	at sun.reflect.GeneratedMethodAccessor378.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
	at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
	at webwork.util.ValueStack.findValue(ValueStack.java:517)
	at webwork.util.SimpleTest.test(SimpleTest.java:408)
	at webwork.util.ValueStack.test(ValueStack.java:157)
	at webwork.view.taglib.IfTag.doStartTag(IfTag.java:40)
	at org.apache.jsp.secure.admin.views.issuefields.screens.viewfieldscreens_jsp._jspx_meth_ww_005fif_005f6(viewfieldscreens_jsp.java:2505)
	at org.apache.jsp.secure.admin.views.issuefields.screens.viewfieldscreens_jsp._jspService(viewfieldscreens_jsp.java:364)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

Cause

It happens because the attribute jira.fieldscreen.id is missing from the workflow - perhaps this screen was deleted.

Resolution 1

  1. Go through Using the Database Integrity Checker first to see if this helps. If not:

  2. Verify if those screens exist the database. It's likely they were somehow deleted:

    SELECT * 
    FROM   fieldscreen 
    ORDER  BY 2;

    (info) If these have been deleted, they can be restored by restoring the entire instance using the XML backup. They cannot be restored by themselves through the application.

  3. You need to find in which Workflow this error is from. This can be done by identifying the workflow with those screen names in it. Replace 'Default Screen' with the screen name from the exception(s).

    SELECT workflowname 
    FROM   jiraworkflows 
    WHERE  descriptor LIKE '%Default Screen%';
  4. Export that workflow to XML. This is done by viewing the workflow and clicking Export > XML.
  5. Search the XML for the screen name, e.g.: 'Default Screen':

        <action id="500" name="Go to Resolved" view="Default Screen">
          <meta name="jira.description"></meta>
          <meta name="jira.fieldscreen.id">1</meta>
          <results>
  6. Change the jira.fieldscreen.id to a valid value from step 1, for example:

        <action id="500" name="Go to Resolved" view="Default Screen">
          <meta name="jira.description"></meta>
          <meta name="jira.fieldscreen.id">10000</meta>
          <results>
  7. Backup the database (using XML or native DB tools).

  8. Import that edited workflow XML.

 

Resolution 2

Alternatively, if you cannot import the workflow or if there are too many workflows to be modified, you can use the following operation that will change the workflows directly in the database. This was only tested in JIRA 7.

This operation relies on database manipulations. 'Resolution 1' is safer and should be used if possible. If you decide to use this resolution, please, take a database backup before doing any changes.

Also, this resolution requires a 'Linux' system, as the script used won't work in Windows (if you're running JIRA in a Windows system, just copy the 'descriptors' file generated in step 1 to a Linux system and proceed from there.

This will replace all non-existing references to screens to a single screen you'll create.

  1. Copy the result of the following 'select' to a file named 'descriptors.xml'

    select descriptor from jiraworkflows;
    1. There are different commands in different databases. The following command works for 'postgres':

      copy ( select descriptor from jiraworkflows ) to '/path/descriptors.xml';
  2. Make sure you have the 'descriptors' file in a Linux system 
  3. Make sure the file has new lines (not the '\n' characters) in XML file. Depending on how the data is copied, each descriptor may be in a single line. If so, this may resolve it:

    cat descriptors.xml  | sed -r -e 's/\\n/\n/g' > descriptors_fixed.xml
    mv descriptors_fixed.xml descriptors.xml
  4. Create a new screen in Screens page in JIRA without any fields and take note of its ID in the URL
  5. Copy the following script to a script file (say fix_workflows.sh) in the same directory as 'descriptors.xml', replacing <NEW_ID>, by the screen's ID

    #!/bin/bash
    
    # Change here!
    NEW_SCREEN_ID=<NEW_ID>
    
    FILE=descriptors.xml
    
    SEARCH_STRING='<meta name="jira.fieldscreen.id">'
    
    cat $FILE | grep "$SEARCH_STRING" | sort | uniq | while read line;
    
    do
    
    	ID=`echo $line | cut -d '>' -f 2 | cut -d '<' -f 1`
    
    	echo -e "\033[0;31m If the following select doesn't return anything\033[0m, run the update below it. \033[0;31mDon't run in otherwise\033[0m"
    
    	echo "select * from fieldscreen where id = $ID;"
    
    	echo "update jiraworkflows set descriptor = replace(descriptor,'<meta name=\"jira.fieldscreen.id\">${ID}</meta>', '<meta name=\"jira.fieldscreen.id\">${NEW_SCREEN_ID}</meta>');"
    	echo
    done
  6. Give it executable permissions:

    chmod a+x fix_workflows.sh
  7. Run it

    ./fix_workflows.sh
  8. Stop JIRA and backup the database
  9. Follow the instructions, run the updated only if the select above it doesn't return anything. This will change only the references to non-existing screens.
  10. Start JIRA

 

Last modified on Mar 18, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.