Skip to main content

Hello,

I'm looking for a way to retrieve all context values that have been set for a case. The siemplify.get_context_property() function only returns one specified context value. I need to be able to retrieve them all, in one API call if possible. Is there a way to achieve this?

Hi Jeferest,


 

There is a method called get_case_context_property(property_key) that returns a case context property. You might be able to utilize this method to retrieve all case context values if you can get a list of all the property keys and loop through them that way. 

get_case_context_property



 



 



get_case_context_property(property_key)

Get a case context property.























Param name Param type Definition Possible values Comments
property_key {string} The requested key property N/A N/A



Hi Ben, I'm aware of the get_case_context_property() function... But I need a way to retrieve the case context properties dynamically without knowing which properties are attached to a case beforehand (different playbooks can be run which add different properties). Is there a way to do this, either with a SDK function call or an API endpoint I can check?


I don't know of a way to do this.  But there is a workaround, but it has a consideration.

Consider
Case.allMythings.key1
Case.allMythings.key2

allMythings is an intermediate JSON key, that stores your dynamic keys inside. This way you can have dynamic keys in a discoverable location.

The value of [Case.allMythings] will be stored/retrieved as a string, so any time you need to edit/update you will need to get the context value, buffer it into a JSON object, then modify and push back.  This would scale well in a Block, but not if you are managing this in a Block (as the platform does not go 2 Block layers deep)

For anyone reading, 2 friendly reminders on context keys:
- Keys are indexed, if you creates lots of keys this will have a non-positive affect on the system. e.g. don't use UID/SHA256 as the keys, and then spam this method
- Values are not designed for big objects.  Small strings, integers yes, but please dont; store files/objects in there, this is not the right place.


Reply