Jump to content

Get Assigned Users After Change


eight

Recommended Posts

Posted

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?

  • 2 weeks later...
Posted

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...