Unique form identifier?

Is there some sort of unique identifier or link that one can use to find/identify a specific form?

So the scenario is that we are using data warehouse to work with the data that is captured from commcare. Pulling it via the api, however their is not really an easy way to distinguish one form from another. Is their some sort of unique identifier that we can see on the api side and then use that identifier to find that specific form in commcare reporting to edit it?

Any suggestions would be greatly appreciated!

Hi Calvin,

Within a form’s metadata there is an instanceID field which is globally unique.

This field comes through the Form Data API, within the metadata JSON object.

You can find the submitted data in the HQ Web App in a couple of ways, including the Find Data by ID feature, or more dynamically by generating a URL like

https://www.commcarehq.org/a/[YOUR_PROJECT_SPACE_ID]/reports/form_data/[YOUR_INSTANCE_ID]

Although it’s not an API level promise that those URL’s won’t change in the future, today it’s a quick way to link to the data.

One side-note: When used in conjunction with Data Cleaning, CommCareHQ have more than one record with the same Instance ID (the instance ID represents a single mobile user transaction, effectively). In this case there will be another GUID associated with the ‘live’ version of that form. In this case there is a top-level field in the Form API labeled “id,” this id is the id for the exact form instance in HQ, and will change if a form is cleaned (it can also differ if duplicate submissions are received from the mobile device due to network issues). Generally speaking the latest form will have a matching instance_id and id field, and the historical (archived/deprecated) copy will receive a new **id. **

Which of these two ID’s is the one you are looking for may depend on your use case.

-Clayton

Thank you so much Clayton, I really appreciate the prompt and detailed response. This is exactly what I was looking for.

I wanted to ask another question though, really hoping you can clear it up for me.
Could you explain to me how external_id works? Is it created automatically or does a user have to enter it when submitting.

I see it referenced here, but not sure how it should or does work.
https://confluence.dimagi.com/pages/viewpage.action?pageId=12224287

Thank you so much for your input!