How do I fix error Attribute `UID` is not assigned to `OrganisationUnit`

  1. I created an optionSet say ‘Tests’ and a set of options
  2. I then create Attribute say ‘LocationTests’ and add the ‘Tests’ optionSet in 1 above
  3. In the field ’ The custom attribute will be applied to selected objects’, I select Organisation unit
  4. In my custom app, I assign array value to the attibuteValues of the OU
    After I submit, I get the error Attribute UID is not assigned toOrganisationUnit``

Which is more like saying that the optionSet is not assigned to the OU
But in the maintenance app, there is no where to assign the optionSet or options to the OU

Unlike in the category options where you can select OU that can access the options

Hi @jetisco4u : based on the error, you may need to verify that the attribute is applied to the Organisation Unit object (or through the api, look at api/attributes/{your_id} and check that organisationUnitAttribute is true.

Keep in mind that if you have assigned an option set to the attribute, you should assign one of the options from the option set to a value of that attribute.

2 Likes

I thought they was direct relationship between the OU and the attribute but after examining the devtools I see there is none except as you describe above which now require that I hardcode the attribute ID into my custom app to set the value in OU

Initially I set option and wanted to use it but the option value is currently set as TEXT while I was using text with multiple values AKA array

So I had to remove the optionSet and use api to set the attribute value as an array though not the ideal thing I want but it serve a temporary solution