How can I resolve the issue in ScriptRunner behaviour where null values in the payload lead to error

Atul wable March 27, 2024

Hi All,

How can I resolve the issue in ScriptRunner behaviour where null values in the payload lead to errors when using functions like getValue, formvalue?

What steps should be taken to ensure proper initialization and population of payload data in the initializer script to prevent empty or null issue objects?

Please find attached a screenshot from the ScriptRunner behavior screen. This screenshot illustrates an issue where null values in the payload are causing errors when using functions like getValuegetValue,

*UI Create form('Test plan'-->customfield_10627--> multi issue picker)

 Captureq3.JPG

Captureq1.JPG

 

*Scriptrunner behaviour initiliser script payload

Captureq2.JPG

Captureq.JPG

Initiliser script:-

Captureq4.JPG

Additionally, it's worth noting that the current ScriptRunner version being used is 8.3.0, which may not be up to date. Kindly inform me if any similar bugs have been reported for this version.

 

2 answers

0 votes
Atul wable April 4, 2024

Anyone can help regards to this question please

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2024

Hi @Atul wable

In your description, you mentioned:-

How can I resolve the issue in ScriptRunner behaviour where null values in the payload lead to errors when using functions like getValue, formvalue?

What steps should be taken to ensure proper initialization and population of payload data in the initializer script to prevent empty or null issue objects?

Please find attached a screenshot from the ScriptRunner behavior screen. This screenshot illustrates an issue where null values in the payload are causing errors when using functions like getValuegetValue,

Could you please specify which field(s) you intend to use to verify if there is any null value?

The ScriptRunner Behaviour Initialiser is used mainly to set a default value when the Create / Edit or Transition screen first loads.

However, if you intend the Behaviour to take effect only after a field value is set, you must use the Server-Side Behaviour.

Please clarify exactly what your requirement is.

For more information, I suggest reading through the ScriptRunner Documentation.

Thank you and Kind regards,

Ram

 

 

 

Atul wable April 1, 2024

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

Thank you for your reply.

 I am looking to set default values for a database picker field within the test execution creation form.

In my scenario, I create test executions from a test plan issue. When a user clicks on the 'Create Test Execution' button, it opens a form where the database picker field is present. 

I want this field to inherit default values from the corresponding field in the test plan issue type, which is essentially the underlying issue of this create form."

When trying to achieve this requirement in ScriptRunner Behaviour, I encounter the following issues: I am unable to obtain the underlying issue ID. Therefore, I pursued an alternative approach: within the creation form, there is a field labeled 'Test Plan'. The ID of the underlying issue is automatically populated there. However, I am still unable to retrieve that issue ID from the creation form.

"When trying to achieve this requirement in ScriptRunner Behaviour, I encounter the following issues: Neither retrieving the underlying issue ID nor fetching values from custom fields is working as expected. All attempts result in obtaining 'Null' values."

I hope I explain my requirement pretty well here

please fill free to ask more questions

Suggest an answer

Log in or Sign up to answer