User creation/edit listener

I am attempting to run some code in my module when a user is created. I've tried using InternalUserRecord.META.addRecordListener, but I can't even get the logger to log in the listener. This is what I have.

InternalUserRecord.META.addRecordListener(new IRecordListener < InternalUserRecord > () {
    @Override
    public void recordUpdated(InternalUserRecord internalUserRecord) {
        logger.info("record updating");
        // some code
    }

    @Override
    public void recordAdded(InternalUserRecord internalUserRecord) {
        logger.info("record adding");
        // some code
    }

    @Override
    public void recordDeleted(KeyValue keyValue) {
        logger.info("record deleting");
        // some code
    }
});

Am I on the right track or is there a better way to accomplish what I'm trying to do?

Hmm, I'd expect that to work, as long as you are testing with an internal user source and adding or removing a user from it.

I don't think we're actually calling out the new user record being added to the rest of the system...

1 Like

Hmm - does deleting a user work? The whole record notification thing is hand cranked by each record type, it looks like when a user gets added it may not be notifying listeners.

I was actually able to get some code to run in the deleted event, but interestingly enough the logger still doesn't log (I tested the logger and it does work outside of this context). Is there a reason the delete event would be firing but not the update or add?

Yeah, because the internal user management code isn't notifying listeners when a user is added. Nothing you can do. I opened an issue :man_shrugging: