Passing the owner_id variable on to a child case using case management

Hello all -- My app, which helps to track health outreach activities and,
in certain conditions, refers clients onward to successive clinics, has two
consecutive "referrals" that can be given, successively.

First, an outreach worker, when interviewing clients, will sometimes
generate a child case to make a referral to a clinic.

But then, when the clinic worker has "picked up" that referral record and
is giving them medical tests, they will sometimes make a subsequent
referral to additional clinic.

Making that second referral was a problem -- because the clinic worker (who
is filling out the form that's creating the additional child case) is in
multiple case sharing groups, so using regular case sharing would
generate an error.

Sheel told me the solution was that, when my form generates that second
child case, I would simply (1) store the current form's owner_id variable
into a hidden value, (2) then use case sharing to pass that hidden value on
to the child case, so the child case would happily just have the same owner
as the form that originated it... which is what I want.

My only problem is in step (1) above. Can you tell me the exact steps to
store the existing owner_id into the hidden value?

  • I tried making a hidden value field called stored-owner-id and then
    having its calculate condition be owner_id ... it gave an error and said I
    probably wanted to put /data/ in front of that, so I did and then it gave
    an error saying that it did not know of a question called owner_id
  • I tried making a hidden value with the exact title owner_id, with
    calculate condition blank -- but that seemed to just retain blank data when
    it run, and so it passed blank on in case management on to the child
    case... in any case, the child case didn't change its owner, it merely kept
    its owner being the userID of the mobile user filling out the originating
    form.

Can you tell me the exact little steps to make it store owner_id into a
hidden value, and then to pass it on to the child case so that the child
has the same owner as the parent? (that second half, I am pretty confident
on, but I'm happy for all inputs!)

Giant thanks!
Eric

Hi Eric,

I think you were on the right track with your second idea.

First you will create a hidden value in the form called owner_id. Leave the
calculate condition blank.

Then in the case management setup you will load owner_id from the case into
the hidden value owner_id (you'll have to just type it in, owner_id won't
show up as a suggestion).

When you configure the "opens a case for a different case list" section,
you need to then make sure to include owner_id in the "save data to the
following case properties" (saving the hidden value owner_id as owner_id).

Let us know if that doesn't work!

Jeremy

ยทยทยท On Mon, May 4, 2015 at 9:12 PM, Eric Stephan wrote:

Hello all -- My app, which helps to track health outreach activities and,
in certain conditions, refers clients onward to successive clinics, has two
consecutive "referrals" that can be given, successively.

First, an outreach worker, when interviewing clients, will sometimes
generate a child case to make a referral to a clinic.

But then, when the clinic worker has "picked up" that referral record and
is giving them medical tests, they will sometimes make a subsequent
referral to additional clinic.

Making that second referral was a problem -- because the clinic worker
(who is filling out the form that's creating the additional child case) is
in multiple case sharing groups, so using regular case sharing would
generate an error.

Sheel told me the solution was that, when my form generates that second
child case, I would simply (1) store the current form's owner_id variable
into a hidden value, (2) then use case sharing to pass that hidden value on
to the child case, so the child case would happily just have the same owner
as the form that originated it... which is what I want.

My only problem is in step (1) above. Can you tell me the exact steps to
store the existing owner_id into the hidden value?

  • I tried making a hidden value field called stored-owner-id and then
    having its calculate condition be owner_id ... it gave an error and said I
    probably wanted to put /data/ in front of that, so I did and then it gave
    an error saying that it did not know of a question called owner_id
  • I tried making a hidden value with the exact title owner_id, with
    calculate condition blank -- but that seemed to just retain blank data when
    it run, and so it passed blank on in case management on to the child
    case... in any case, the child case didn't change its owner, it merely kept
    its owner being the userID of the mobile user filling out the originating
    form.

Can you tell me the exact little steps to make it store owner_id into a
hidden value, and then to pass it on to the child case so that the child
has the same owner as the parent? (that second half, I am pretty confident
on, but I'm happy for all inputs!)

Giant thanks!
Eric

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Jeremy Wacksman
Dimagi http://www.dimagi.com, Inc.

Total success! Thank you much!

Here is a silly side question. In order to use that method to use the case
management setup to insert the owner_id into that hidden value field I
made, the form had to actually have a slot to load case properties into the
form. In other words, it could not be a registration form... it had to be
an "updates or closes a case" form. Just curious... what if my situation
was such that I wanted to pass client_id on to a child case in this way...
but do it from a registration form? I couldn't use the "load case
properties" section... how would I do it? (note, it might be that that
problem would never arise, because you'd not be having any problem with
case management in that scenario... but still interested to hear if you
know of a way to do that.)

Thanks again, this solved my problem --

Eric