I want to use enrolling org unit to define program rule. I have a field “List of Partners” and I want to fill it with values based on the org unit when the entity is enrolled. I am using program rule and program rule variable, How can I get the enrolling org unit in the program rule variable.
What value is saved in the V{orgunit_code} and how do I get it? Is this created manually when adding OrgUnits (in the Code field) or it’s auto-generated by DHIS2?
Hi @WaluQ, @SDKAAA you’re free to add to this please but I’d like to add to @WaluQ that the expression V{orgunit_code} in the program rule will evaluate to the orgunit code so you don’t need to change it to V{OU_651071} .
When creating an OU, you have the option to add a CODE to it and if you don’t it won’t have a CODE. If you’d like to see how many Organisation Units in your system already have a code, you can try: instance-uRL/api/organisationUnits?fields=id,code,name