Confluence Vers: 7.1.0
Scriptrunner Vers: 6.4.0-p5
Hello,
I am trying to copy pages based off of an event listener, and I keep getting the following error
java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877) at com.atlassian.confluence.pages.persistence.dao.bulk.DefaultBulkOptions$BaseBuilder.buildDefault(DefaultBulkOptions.java:90) at com.atlassian.confluence.pages.persistence.dao.bulk.copy.PageCopyOptions$Builder.build(PageCopyOptions.java:158) at com.atlassian.confluence.pages.persistence.dao.bulk.copy.PageCopyOptions$Builder$build.call(Unknown Source) at TEST_Archive_Document_2.run(TEST Archive Document 2.groovy:13)
with the code below.
import com.atlassian.confluence.event.events.content.page.PageEvent
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.AbstractPage
import com.atlassian.confluence.pages.persistence.dao.bulk.copy.PageCopyOptions
import com.atlassian.confluence.pages.persistence.dao.bulk.copy.PageCopyOptions.Builder
import com.atlassian.confluence.pages.persistence.dao.bulk.DefaultBulkOptions
import com.atlassian.confluence.pages.persistence.dao.bulk.DefaultBulkOptions.Builder
import com.atlassian.confluence.pages.persistence.dao.bulk.DefaultBulkOptions.BaseBuilder
def pageManager = ComponentLocator.getComponent(PageManager)
def builderPage = PageCopyOptions.builder()
PageCopyOptions pageCopyOptions = builderPage.build();
Page originalPage = pageManager.getPage(10818720)
Page destinationPage = pageManager.getPage(10818723)
pageManager.deepCopyPage(pageCopyOptions, originalPage, destinationPage)
Additionally, I've tried using the canned CopyTree function, but have had no luck.
Just stumbled upon this older question.
cfValuesis a map-like structure where you can get the value of any custom field on the object. Note that the keys are the field name, and not id.
You will have to access the field value by its name, the name like you will find it in the administation for custom fields in Jira.
cfValues['nameOfField'] == 'Bug' || cfValues['nameOfField'] == 'Enhancement'
try this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.