Forums

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

Power Scripts for Jira Live Fields : How to access Sub-task parent issue field on Sub-task creation?

Christophe Floquet February 28, 2020

Hello,

I'm using Power Scripts for Jira with Live Fields.

What I want to do is to rectrict the values of a custom field (let's call it XXX) in the Sub-task creation screen based on the value of a custom field (let's call it YYY) in the "not yet" parent issue ("not yet", because we are in the Sub-task creation screen).

I've created a Main script calling a hook script in case of Sub-task creation screen:

if ( argv["screen"] == "create-subtask" )
{
  lfInstantHook("issueType", "hook.sil");
}

My problem is : how to access parent issue custom field XXX value in the hook script (hook.sil) ? (use %parent% doesn't work)

 

Thanks.

Christophe

1 answer

1 accepted

0 votes
Answer accepted
Hyrum Steffensen--Cprime February 28, 2020

Hello Christophe,

This is an interesting question. You can access the key of the parent issue with "key". As you have pointed out, the variable "parent" does not yet exist (normally accessed as "key.parent") because the parent relationship has not yet been established. Your hook script would look something like this:

if (key.customfield_1234 == "option1") {

    lfRestrictSelectOptions("name of custom field", {"element2", "element4"});

}

https://confluence.cprime.io/display/JJUPIN/lfRestrictSelectOptions

https://confluence.cprime.io/display/JJUPIN/lfAllowSelectOptions

If you would like to discuss this or other scripts with me, feel free to stop by chat and we will be happy to help out.

Regards,

Hyrum Steffensen

Product Engineer, Power Scripts

https://drift.me/hyrumsteffensen

Christophe Floquet March 9, 2020

Hello Hyrum,

It works fine!

Thanks.

Regards,

Christophe

Hyrum Steffensen--Cprime March 10, 2020

Absolutely! Glad to help!

Hyrum

Suggest an answer

Log in or Sign up to answer