Forums

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

Confluence- get page id from 'LabelAddEvent' - event listeners

Dan27
Contributor
April 13, 2020

I use 'Label Add Event', and I need to get the page id.

How can I do it in 'event listeners'?

 

I have Confluence version 6.13.8

 

Tnx,

Daniel

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Andrea Pannitti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 2, 2022

Hi @Daniel R_,

your approach is correct but, according to HTML specs, the select tag in HTML doesn't have a readonly attribute, only a disabled attribute; so it doesn't work. A good workaround to do this, is the following:

def childElement = getFieldById("customfield_13062:1")
// To Disable
childElement.setDescription("<style onload=\"document.getElementById(\'customfield_13062:1\').setAttribute(\'disabled\',\'\')\"></style>")
// To Enable
//childElement.setDescription("<style onload=\"document.getElementById(\'customfield_13062:1\').removeAttribute(\'disabled\')\"></style>")
Daniel R_
November 16, 2022

Hi @Andrea Pannitti

Sadly it appears that ScriptRunner's Behaviour getFieldById is not correctly sanitized and will throw an exception if trying to select a field with a colon in it's name.

Thanks for your help anyway.

Like Daniel R_ likes this
TAGS
AUG Leaders

Atlassian Community Events