# Event Triggers and Generating Campaigns

**URL:** <https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411>\
**Category:** SHF Discussion and Questions\
**Created:** [April 15, 2021, 8:40am UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411 "2021-04-15T08:40:37Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrianhannen](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@adrianhannen](https://developer.sailpoint.com/discuss/u/adrianhannen)\
**Post date:** [April 15, 2021, 8:40am UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/1 "2021-04-15T08:40:37Z")

</div>

First, I want to say I found the recording of the SailPoint / AWS ‘Howdy Partner’ event really helpful in understanding how to setup EventBridge to see and handle Events from IdentityNow - so thanks!

I have used the example provided in the demo (@neil.mcglennon) and the code for the AWS Lamdba to generate a campaign following a change in an Identity Attribute. And it works, sort of!

The main issue is with the activation of the campaign: it mostly fails (not every time) with an error 'IllegalArgumentException: Campaign xxxxxxxxxxxxxxx is not in a Staged Status. Only Staged campaigns can be activated. I think the problem is a race condition - the AWS Lambda code is generating the campaign and trying to activate it before it is ready (‘staged’).

My question is, how do I extend the code to ensure the activation call works every time?

I have extended the example code to try an ‘sleep’ to introduce a delay - but that is not certain to work.

I will be extending the project (as time permits): I have already modified the code to lookup the subjects Manager to dynamically select the reviewer for the campaign - which seems to work ok. I will work on other models for selecting different campaign reviewers such as role owner. I will also extend the code to set the campaign duration to a week from creation.

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [April 15, 2021, 3:01pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/2 "2021-04-15T15:01:51Z")

</div>

@adrianhannen, thanks for posting this question. Neil is going to pop over and share his thoughts on the best path forward you when he has a meeting-free moment today. Hang tight!

---

<div class="post-metadata">

**Author:** ![neil\_mcglennon](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/neil_mcglennon/32/4160_2.png) [@neil\_mcglennon](https://developer.sailpoint.com/discuss/u/neil_mcglennon)\
**Post date:** [April 16, 2021, 1:36pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/3 "2021-04-16T13:36:05Z")

</div>

Hi @adrianhannen,

Thanks for watching the AWS Howdy Partner session! I am glad you found it helpful!

In order to create a certification via our API, there are two steps. First, you call an API to create a certification. Once this is created, it is generated and goes into a “staged” status. Once that is complete, then you can second, call an API to activate it so end users can see it. You should be able to see those API calls in the AWS Lambda provided.

The error you are are seeing is because you are attempting to activate a certification that is not quite in the “staged” status yet - i.e. it is still generating.

As a quick solution, you can setup a delay or sleep in between API calls to give it more time to generate.

As a long-term solution, this isn’t ideal. The SailPoint take-away is it would be able to be better to be able to call into our create certification APIs and skip the “staging” and go immediately to the “active” stage. That might be something @jordan.violet or @colin_mckibben can take-away with our API product teams.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![adrianhannen](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@adrianhannen](https://developer.sailpoint.com/discuss/u/adrianhannen)\
**Post date:** [April 16, 2021, 2:54pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/4 "2021-04-16T14:54:51Z")

</div>

Thanks for the quick response.  
I kinda thought that would be the case.  
I will invest some time to see if I can poll a campaign for it’s state and when ‘staged’, fire in the ‘activate’ call.

---

<div class="post-metadata">

**Author:** ![neil\_mcglennon](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/neil_mcglennon/32/4160_2.png) [@neil\_mcglennon](https://developer.sailpoint.com/discuss/u/neil_mcglennon)\
**Post date:** [April 27, 2021, 11:09am UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/5 "2021-04-27T11:09:17Z")

</div>

Thanks @adrianhannen - Let us know what you end up building!

---

<div class="post-metadata">

**Author:** ![sailajaprathi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sailajaprathi/32/216_2.png) [@sailajaprathi](https://developer.sailpoint.com/discuss/u/sailajaprathi)\
**Post date:** [May 24, 2021, 8:10am UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/6 "2021-05-24T08:10:41Z")

</div>

Hi Neil,

I am trying to find the inputs for Certification Campaign creation. Could you please share the AWS Howdy Partner session which have these details?

Thank you!

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [May 24, 2021, 6:01pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/7 "2021-05-24T18:01:09Z")

</div>

Hey @sailajaprathi,

I believe this might be the link you are looking for:

> **[AWS - Twitch](https://t.co/v18L5pAhPh?amp=1)**
>
> Amazon Web Services (AWS) is a secure cloud services platform offering compute power, database storage, content delivery, & other functionality. Explore live coding demos 💻, training and certification tutorials 📚, and events coverage 🌎, learn...

---

<div class="post-metadata">

**Author:** ![sailajaprathi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sailajaprathi/32/216_2.png) [@sailajaprathi](https://developer.sailpoint.com/discuss/u/sailajaprathi)\
**Post date:** [May 24, 2021, 6:13pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/8 "2021-05-24T18:13:09Z")

</div>

Hi Michael,

Thank you for the link.

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [May 24, 2021, 6:44pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/9 "2021-05-24T18:44:29Z")

</div>

No Problem, I am happy to help!

---

<div class="post-metadata">

**Author:** ![chrisp](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@chrisp](https://developer.sailpoint.com/discuss/u/chrisp)\
**Post date:** [July 3, 2021, 7:58pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/10 "2021-07-03T19:58:07Z")

</div>

I’m getting this same error, have you found a way to poll the campaign for its state, so I can then do the activate?

Or does anyone have a good guess on what the delay should be?

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [July 8, 2021, 2:59pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/11 "2021-07-08T14:59:31Z")

</div>

@chrisp You can use this [endpoint](https://developer.sailpoint.com/idn/api/beta/get-campaign). You just need to supply the campaign ID and then check the `status` property. When you are ready to activate, you can use [activate-campaign | SailPoint Developer Community](https://developer.sailpoint.com/idn/api/beta/activate-campaign).

---

<div class="post-metadata">

**Author:** ![chrisp](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@chrisp](https://developer.sailpoint.com/discuss/u/chrisp)\
**Post date:** [July 8, 2021, 5:55pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/12 "2021-07-08T17:55:35Z")

</div>

Thanks Colin. This should be very helpful.

---

<div class="post-metadata">

**Author:** ![questjj](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/questjj/32/25216_2.png) [@questjj](https://developer.sailpoint.com/discuss/u/questjj)\
**Post date:** [September 1, 2021, 10:19pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/13 "2021-09-01T22:19:16Z")

</div>

This demo was awesome and the use case of firing off a cert campaign on attribute change has to be something almost every IdN customer wants.

Is there plans to extend event trigger “Subscription Type” options? If I could select “Manager Certification” with a couple configurable options and the 3 required API calls were made for me behind the scenes, that would be a game changer.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:21pm UTC](https://developer.sailpoint.com/discuss/t/event-triggers-and-generating-campaigns/411/14 "2023-07-19T14:21:49Z")

</div>

Closed on July 19, 2023, 2:21pm UTC


