# Listener rule to send OldValues when new value is null

**URL:** <https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146>\
**Category:** IIQ Discussion and Questions\
**Tags:** identityiq, rules\
**Created:** [January 27, 2025, 9:29pm UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146 "2025-01-27T21:29:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramthetribo](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@ramthetribo](https://developer.sailpoint.com/discuss/u/ramthetribo)\
**Post date:** [January 27, 2025, 9:29pm UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146/1 "2025-01-27T21:29:20Z")

</div>

Hello,

Need some help with Listener rules.  
We use IIQ 8.4.  
I am trying to send oldValue if the new value is null in the listener rule. here is the piece of code i have come up with.

import sailpoint.api._;  
import sailpoint.object._;  
import java.util.\*;

log.error(“First name old value:::”+oldValue);  
log.error(“First name new value:::”+newValue);

if (newValue == null && oldValue != null){  
log.error(“New value null and old value is not null”);  
if (identity.getType()!=null){  
String usrIdentityType = identity.getType();  
if (usrIdentityType.equalsIgnoreCase(“contractor”) || usrIdentityType.equalsIgnoreCase(“external user”) ){  
log.error(“Type is not null if condition true:::”+usrIdentityType);  
newValue = oldValue;  
log.error(“Final First name old value:::”+oldValue);  
log.error(“Final First name new value:::”+newValue);  
}  
}  
}

When i send new value as null through aggregation, it prints the old value as new value in the last log.error statement however newValue is still being sent as null and it’s getting removed from Authoritative source and identity cube.

Please review and let me know if i miss anything.

---

<div class="post-metadata">

**Author:** ![SanjeevIAM](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sanjeeviam/32/21695_2.png) [@SanjeevIAM](https://developer.sailpoint.com/discuss/u/SanjeevIAM)\
**Post date:** [January 28, 2025, 1:46am UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146/2 "2025-01-28T01:46:32Z")

</div>

Listener rule is usually used to detect any changes in attribute values and if you need to take any action based on change you will need to call the Listener workflow.  
It seems you need to set attribute based on a particular condition and so its better you create a Source mappings Application rule or Global rule to handle this.

---

<div class="post-metadata">

**Author:** ![ramthetribo](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@ramthetribo](https://developer.sailpoint.com/discuss/u/ramthetribo)\
**Post date:** [January 28, 2025, 5:19pm UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146/3 "2025-01-28T17:19:18Z")

</div>

Hello Sanjeev,

We have source mappings. In some cases, we won’t be getting the data for some users after a few months. In such cases, we want to retain whatever is there in SailPoint so i was thinking to use listener rule and pass oldvalue as new value. Any additional info to get this done would be rally helpful.

---

<div class="post-metadata">

**Author:** ![SanjeevIAM](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sanjeeviam/32/21695_2.png) [@SanjeevIAM](https://developer.sailpoint.com/discuss/u/SanjeevIAM)\
**Post date:** [January 28, 2025, 7:31pm UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146/4 "2025-01-28T19:31:38Z")

</div>

You can try to do that using a global rule for your source mapping. I see oldValue as one of the arguments and you have identity as another argument which can be used to get the application attribute you want to check and set this identity attribute to

---

<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:** [March 29, 2025, 7:31pm UTC](https://developer.sailpoint.com/discuss/t/listener-rule-to-send-oldvalues-when-new-value-is-null/99146/5 "2025-03-29T19:31:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
