get patient uuid with fieldgen

Hi there!

does anybody have an idea how I could get the UUID instead of the patient ID using the openmrs:fieldGen of type Patient?

When looking at:

I dont see how, my only thought is to create my own custom patientField.tag where I replace ui.item.object.patientId with ui.item.object.uuid

The reason why I need this is that I am now using REST to populate my datatables in the legacyui and need the patients UUID as a param.

I am trying to create a custom patientUuidField.tag which uses value ui.item.object.uuid

How do I use this field tag then?

I tried setting the url in

 <openmrs:fieldGen type="org.openmrs.Patient"
            formFieldName="patientQuery" url="patientUuid.field" />

but that didnt work out. Not sure if this is because I am in a module, so I need a prefix to the url for it to find my custom field (it currently lives under omod/src/main/webapp/tags/patientUuidField.tag) or do I also need to write a FieldGenHandler?

Thanks a lot for any hints :slight_smile:

Here is an example of the things you need to do:

  1. You create the tag file as here:

  2. Include it in your jsp with as prefix as here:

  3. Then access it as here:

NOTE: field gens are different from your tag. :slight_smile:

1 Like

spot on! just what I needed :wink: thank you soo much!

can you tell me what the difference is between a “normal” tag and a field gen?

For the field gen,

  1. Instead of the jsp, you would create a Java file as here:

  2. Configure it in the tag library descriptor file as here:

  3. Include it in your jsp with a prefix as here:

  4. Then access it as here:

As for the difference between the two, you can start with this:

thanks for the extensive explanation and your help!!