Hello. I am looking for an example Scriptrunner script for adding a new entity to a notification scheme in Jira. I need to add a new entity to a lot of notification schemes and everything I have tried is far from complete.. Hoping someone has an example on hand.Thanks in advance!
By "entity" do you mean a (type of) recipient, or a new event?
To explain that a little, each row of a notification scheme, in plain English says:
When <an event of type x> arrives, send an email about it to <a set of people defined by...>
So I'm asking if your "entity" means an event or a set of people?
@Nic Brough -Adaptavist- I am hoping to add a user picker custom field to an existing scheme/entitytypeId (issue created)I was attempting to build an entity object and then add it to the Scheme but I may have been going about it the wrong way. I did find the "swap entity parameters" method but that only works if the parameter type is already existing in the entity. Using your example, I want:When an event of typeId 2 arrives, send an email about it to the users within a user picker custom field.
So that does not tell me what "entity" means. To be blunt and grumpy about it, a notification scheme has "Events" and "People to tell", there's no "entity" mentioned. The middle paragraph does not work for me.
But the first and last paragraphs really do work for me, they're crystal clear.
On the first paragraph: "I am hoping to add a user picker custom field to an existing scheme/entitytypeId (issue created)". You can do that. In the notification scheme, find "issue created" and then add "custom field -> <your user picker custom field>" to it
On the last one "When an event of typeId 2 arrives, send an email about it to the users within a user picker custom field" - find the event to notify people on and, as the one above, add the user picker custom field as one of the rules to notify people about on that event.
Note - I have a nagging doubt that we've not mentioned events much - have you added some custom events and then added them to workflows (if not, then did you mean to?) and then used them in notifications?
@Nic Brough -Adaptavist-My overall goal is stated fairly clearly in my last comment:I am hoping to add a user picker custom field to an existing scheme/entitytypeId (issue created) using a scriptrunner script. This would be via the API, which does contain Schemes, Entities, etc. as I mentioned. It seems as though the response received has convoluted this. Please provide an example if you have a script on hand, if not, I am hoping another member of the community has one.
It looks like you're new here. Sign in or register to get started.