Saving owner_id using 'save to case' throws an unknown error

Hello,

Extension cases created using save to case assigns the health post ID for owner_id. And, commcare report won't read or count from such cases unless the owner_id is blank ("-"). So, to solve this, I saved the value of owner_id as blank on save to case control as shown below. I also tried storing "-" on hidden value and saving it as owner_id.

And, it works as expected on commcarehq form player, however completing the form on a device/tablet throws an unknown error. Here is the screenshot.

I would appreciate any help.

Mariawit S.Y

Hi Mariawit, to save a blank value, I'd recommend putting "" in the owner_id value field rather than "-"

While commcare reports and exports show blank values as ---, when actually saving a blank value to a case property in form builder, you should save it as null using "" as the value

The only caveat is that I'm not sure I understand why you need to save a blank value - you should not have to just to be able to create a case-based report:

And, commcare report won't read or count from such cases unless the owner_id is blank ("-"). So, to solve this, I saved the value of owner_id as blank on save to case control as shown below.

Can you explain that a bit more?

Thank you Ali.

I have already tried putting "" in the owner_id field. That didn't work as well. It throws the same error (Unknown error) on device and it saves the health_post_id in place of the owner_id when it is on form player.

I want to save blank value because by default health_post_id is saved as owner_id when the case is created.


For extension cases, the report only counts cases with blank owner_id, so it skips cases created like this.

Mariawit S.Y

Hi Mariawit,

I understand now why you are saving owner_id as blank now, that makes sense. I can see in the example you gave, it's saving the mobile worker as the owner_id by default when you leave it blank. That makes sense - that's what CommCare defaults to when you don't manually set the owner_id as anything.

I can see from looking at your application that there are already places in the app that are successfully saving the owner_id as blank. The 'Create PLW Emergency Referral for Referral Feedback' form for example. In this form, it was done using normal case management (not save-to-case). Are you not able to use the same method for this form, or is save-to-case needed?

If you do need save-to-case for the case management in this form, then I think you'd need to submit a support ticket so our team can look into why this behavior is happening one way in some forms with advanced case management and another way in forms with save to case. I tried investigating quickly but wasn't unable to find an obvious answer - so I think this would need to go to our support team. Please link this thread in your support ticket.

Thanks,
Ali