How to load a case_id into a form

commcare

I've setup case management in my application. Now I would like to load the selected case's id into the Calculate Condition of one of my hidden variables. How do I do that?

Best Answer

You can use the session instance path to get the currently selected case's case_id (see CommCare Session Instance help page):

instance('commcaresession')/session/data/case_id

The link above also describes the syntax to load other session user or device data.