Skip to main content
Question

How Can I Retrieve All Context Values for a Case?

  • September 9, 2024
  • 6 replies
  • 174 views

Forum|alt.badge.img+1

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?

6 replies

Ben_T
Staff
Forum|alt.badge.img+4
  • Staff
  • September 12, 2024

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

Forum|alt.badge.img+1
  • Author
  • Bronze 1
  • September 12, 2024

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?


SoarAndy
Staff
Forum|alt.badge.img+12
  • Staff
  • September 13, 2024

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.


AnimSparrow
Forum|alt.badge.img+5
  • Bronze 2
  • December 14, 2025

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.

​@SoarAndyΒ Β - long time but got question

is there a place or way to perform cleanup? I can see that we have some old not used context that are still showing under our case placeholder. I would like to get rid of them - is there any method for that?


SoarAndy
Staff
Forum|alt.badge.img+12
  • Staff
  • December 16, 2025

AFAIK there is no delete, but you can set it to β€œ-”

There is unlikely to be any problems with storage or speed, I assume this question is about keeing the Alert view cleaner?


AnimSparrow
Forum|alt.badge.img+5
  • Bronze 2
  • December 16, 2025

AFAIK there is no delete, but you can set it to β€œ-”

There is unlikely to be any problems with storage or speed, I assume this question is about keeing the Alert view cleaner?

it is not on cases but overall inΒ  β€œ [Β  ] ” you are able to see those wrongly created placeholders/context

so in case/alert there are no issue - only with predefined remembered by platform fields