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.
I'm afraid that makes it even worse. I cannot work out what you're trying to do at all from that.
I'm going to guess that what you're trying to do is either
Is it one of those two? If not, then can you tell us what you're trying to do without talking about entities, apis or any of the internals, just explain what changes for the end-user as a result of doing it.
(What I suspect has confused me here is the references to notifications and emails - they have nothing to do with fields directly, and I've been trying to chase down what you mean by "add entity to notification scheme")
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events