Get Assigned Users After Change
1 1

2 posts in this topic

I'm using the new API. With it, I'm trying to get the users assigned to a task when they are added or removed, but this is giving my trouble. First of all, the entity in the event I get has 'changes': None. So I can't get the user list from this like I normally would. The other thing I tried to do was query the Task and get its 'assignments'. This works the first time, but because of caching, it does not work anymore after that. Is there a way to temporarily ignore the cache similar to how someone would turn off auto_populating?

Share this post


Link to post
Share on other sites

Hey,

You can refresh specific attributes by requerying them. The easiest way is to use Session.populate. Note that because of the way collection attributes are handled you will also need to clear the 'local' value to pick up the newly fetched remote value.

session.populate(task, 'assignments') # This updates the remote value.del task['assignments']  # This clears the local value so that you see the new remote value.

We are aware this is not the most intuitive approach and plan to make this easier and even build in automatic cache invalidation in future.


Martin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1