Search This Blog

Thursday, December 10, 2015

Hand editing the User.xml file

Sometimes the User.xml file is corrupted or there is a missing field.  You will see the field in the database, in the User Entity object in the System Administration Webapp (with a sandbox open), maybe even in the metadata/iam-features-requestactions/model-data/ModifyUserDataset.xml and CreateUserDataset.xml files.  Just missing from the User.xml file.

One way to correct this issue is to hand edit the file.  When doing this, use Notepad++ so you can see everything and make sure that the file stays valid (or you can use XMLSpy).

Open the file and search for the UDF section:

find the <entity-attributes> tag.  Inside this tag are a collection of <attribute name= tags.

You should (in unix) grep for 'attribute name=' and check to make sure you don't have multiple missing entities, but for this example just concentrate on the one.

Copy any <attribute tag section, all the way to the </attribute> tag, and paste it below.  You may have good luck copying something that looks similar to the tag that is missing.

Then do the following:
Change the name in the initial tag name="XXX" to the new field name
Change the name where it is referenced below the <name>scim</name> tag.
Change the value below the <name>max-size</name> tag to the field width.  Check the database for this value.

Next go to the <target-fields> tag and find a UDF.  Copy and paste a similar <field name= tag, then edit as follows:
Change the name of the initial tag name="xxx" to the new database table field name.  It should start with usr_udf.

Next find the <attribute-maps> tag and find an <attribute-map> tag to copy.  Copy and then:
Change the name of the entity-attribute to match.
Change the name of the target-field to match.

Next find the <metadata-attachment> tag.  Below this are all of your UDFs and several of the OOTB fields.  You need to make a spreadsheet of all of the <name> attributes and the the <value> attributes for those entries with category of categories.Basic User Information.
Compile this list and then sort by name.  Name is a number.  Look for a gap.  If there is a gap, I suggest your new entry should fill the gap.  If there is no gap, add one to the last value and use it.  You will copy a block from the Basic User Information section and rename the value and use the number for name.

Save the file.  Import it using the procedure I have outlined in my blog - search on importMetadata