Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete drafts or unsused pages in Project pages in Jira Software

Aizat
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 25, 2022

Hello. I'm new to Jira Software.

I am trying to delete unused project pages or drafts, but I cannot find the delete button. I don't want to hide Project pages, just delete the rest of the pages inside it.

See attachment for reference.

Thank you so much!

 

CleanShot 2022-04-26 at 00.14.55@2x.png

1 answer

0 votes
Sanjay
April 30, 2017

There are couple of things needed to be corrected in your code.

Inshort, you can check this post:

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-get-the-checked-values-in-a-custom-field-and-apply-them/qaq-p/575065

Let me know if this works for you :)

Ben Cohen
April 30, 2017

Hi Sanjay,

Thanks for the replay.

I am new to groovy so I guess I will have alot of problems at first.

I do not understand how to implement the answer in this post to my problem.

Sanjay
April 30, 2017

Try these, i haven't checked in any environment, please excuse :

def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Customer Related");

instead of this, try for getCustomFieldObject("customfield_xxxx")

where xxxx is the ID of the custom field

Sanjay
April 30, 2017

Also, issue.getCustomFieldValue(customField) instead of customField.getValue(issue)*.value

 

Also

if (selectedValues*.value.contains("Related")) {

#Do your stuff


}

Ben Cohen
April 30, 2017

Its still not working for me.

in getCustomFieldObject("customfield_xxxx") I should keep the "customfield" and just change the xxx right?

for example: customfield_1000

it could be a problem with this line?

def issue = ComponentAccessor.getIssueManager().getIssueObject("ISSUE-1")

Sanjay
April 30, 2017

Yes, you are right 

 Issue issue =

If this doesn"t work then I can come up after checking this in an environment(i don't have right now)

Also I would say to log each step then you will come to know which is causing exact problem.

 

 

Ben Cohen
April 30, 2017

Also, there could be a problem with those two lines?

Issue issue =

And

MutableIssue issue = issue

(as they both have the same variable name)

I tried to run this by itself, and it worked, the assignee changed:

    userManager = (UserManager) ComponegntAccessor.getUserManager()
    MutableIssue issue = issue
    User usera = userManager.getUser('Username');
    issue.setAssignee(usera);
    issue.store()

So the problem is with the condition. Still cant figure what it is exactly.

Sanjay
April 30, 2017

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;

ComponentManager componentManager = ComponentManager.getInstance();
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();

CustomField customer_Related= customFieldManager.getCustomFieldObject("customfield_xxx");

customer_Related_Value = issue.getCustomFieldValue(customer_Related)

if (customer_Related_Value*.value.contains("Related"))

{

User usera = userManager.getUser('Username');
issue.setAssignee(usera);
issue.store()

}

Ben Cohen
May 5, 2017

Still nothing happends. There could be a problem with the post function order?

At this moment the script is runing right after "Creates the issue originally"

Suggest an answer

Log in or Sign up to answer