# Programme rule only generates UIC after saving client – DHIS2 2.42

**URL:** <https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520>\
**Category:** Support - Assistance technique\
**Tags:** tracker\
**Created:** [16 October 2026 16:16 UTC](https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520 "2026-10-16T16:16:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jschofieldwood](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/j/13edae/32.png) [@jschofieldwood](https://community.dhis2.org/u/jschofieldwood)\
**Post date:** [16 October 2026 16:16 UTC](https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520/1 "2026-10-16T16:16:20Z")

</div>

Hi everyone,

We’re using DHIS2 2.42 and have noticed an issue with our programme rules in the Capture app.

We have several Tracker programmes with rules that automatically generate a unique client identifier (UIC) by combining values from other tracked entity attributes in the registration form.

Previously, the UIC would populate as soon as all the relevant fields were completed, before saving the client. However, since upgrading to 2.42 and moving to the new Capture app, the UIC only generates after the client has been saved.

The rules are still working and generating the correct UIC, just not until after saving. All the fields involved are tracked entity attributes in the registration form.

This is causing an issue because we previously had the UIC set as mandatory. We’ve now had to remove that requirement, as otherwise users can’t save the client without a UIC, but the UIC won’t generate until they’ve saved the client!

Has anyone else experienced this? Is it a known issue with Capture 2.42, and is there a way to get the UIC to populate before saving again?

Thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [20 October 2026 13:56 UTC](https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520/2 "2026-10-20T13:56:44Z")

</div>

Hi @jschofieldwood

Is there a chance you are facing a similar issue as Carols and Mohammad in this topic: [Program rule cascading issues](https://community.dhis2.org/t/program-rule-cascading-issues/74868).

If you are not using multiple program rules that rely on each other then let’s have a closer look at the program rule that generates the UIC. Would you share these points:

1. PR Rule Expression
2. PR Action definition and "Expression to evaluate and assign
3. PR Variables (source type for each variable)
4. PR Priority

One question that I have since you mentioned that this worked before the upgrade is whether this worked in Capture app or only the legacy Tracker Capture app?

FYI, if we can reproduce the issue on [play.dhis2.org](http://play.dhis2.org) then we will be able to immediately triage to the team. 🙏

Thank you!

---

<div class="post-metadata">

**Author:** ![jschofieldwood](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/j/13edae/32.png) [@jschofieldwood](https://community.dhis2.org/u/jschofieldwood)\
**Post date:** [21 October 2026 13:46 UTC](https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520/3 "2026-10-21T13:46:23Z")

</div>

Hi Gassim,

Thanks very much for your response!

I’ve looked at the other topic, but I don’t think it’s quite the same issue, as we’re not using multiple programme rules that depend on each other to generate the UIC. We have a single rule that combines values from four tracked entity attributes in the registration form.

Here’s the configuration of one of our rules:

**1. Programme rule expression**

```auto
d2:hasValue('REA- First two letters of mothers first name')
&& d2:hasValue('REA- First two letters of town of birth')
&& d2:hasValue('REA- CM- Month of birth')
&& d2:hasValue('REA- CM- Last 2 numbers of clients year of birth')

```

**2. Programme rule action**

Action: Assign value to tracked entity attribute `REAct UIC`

Expression to evaluate and assign:

```auto
d2:concatenate(
d2:left(A{REA- First two letters of mothers first name},2),
d2:left(A{REA- First two letters of town of birth},2),
d2:left(A{REA- CM- Month of birth},2),
d2:left(A{REA- CM- Last 2 numbers of clients year of birth},2)
)

```

**3. Programme rule variables**

All four variables have _Tracked entity attribute_ as their source type.

**4. Programme rule priority**

No priority has been set.

Regarding your question about Capture, the rule worked in the legacy Tracker Capture app, but I’m also fairly sure it was working in the new Capture app when we initially upgraded to 2.42. I tested the programme rules as part of our upgrade testing, and I remember the UIC generating correctly before saving. The issue seems to have started shortly afterwards.

The rule still generates the correct UIC, but only after saving the client.

Happy to share screenshots or help reproduce the issue on [play.dhis2.org](http://play.dhis2.org) if that would be useful.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [9 November 2026 18:38 UTC](https://community.dhis2.org/t/programme-rule-only-generates-uic-after-saving-client-dhis2-2-42/77520/4 "2026-11-09T18:38:06Z")

</div>

Hi @jschofieldwood

First of all, thank you so much for the detailed steps. They helped me a lot, and I’m so sorry for the delay.

Good news though is that I was able to achieve what you mentioned. I tried to reproduce this issue but couldn’t.

I followed your steps and I was actually able to generate a concatenated code for a TEA based of first letters of a number of other TEAs.

Please see the following and let me know if I missed anything:

First, you can see in the GIF below that the TEA ‘TEST - CONCATENATE’ is assigned the value based on ‘Firstname, Lastname, and Gender’:  
 ![](https://dhis2.b-cdn.net/uploads/default/original/3X/8/6/86fa85f63ffd1e514500eda3c01ed275becaec8e.gif)

Second, here are the configuration settings on play:

1. TEA is value type Text and all the other options are kept as is

2. TEA is assigned to TE type “Person”  

3. Program rule variables were created for each TEA (Firstname, Lastname, and Gender)  

4. Program rule:

- Program: ‘Child Programme’  

- Expression:

```auto
d2:hasValue(#{TESTING-firstName}) && d2:hasValue(#{TESTING-LastName}) && d2:hasValue(#{TESTING-Gender})

```

(This ensures that when these fields are filled, the TEA concatenate is filled.)

 ![](https://dhis2.b-cdn.net/uploads/default/original/3X/6/a/6abb84aaacedeec3a35d53bf96aea395a72a4102.png)

- Action: Assign value \> TEA, with expression:

```auto
d2:concatenate(d2:left(#{TESTING-firstName},2),d2:left(#{TESTING-LastName},2),d2:left(#{TESTING-Gender}, 2))

```

 ![](https://dhis2.b-cdn.net/uploads/default/original/3X/e/5/e57abd3b57e5464cc6402ca0e5f0182a40a218d2.png)

* * *

> [@jschofieldwood](#):
>
> The rule still generates the correct UIC, but only after saving the client.

So as you can see from above, the value was assigned before I even saved.

* * *

This was tested on Capture App, version 107.9.1.

Thank you!
