Creating metadata value relationships
- by kyle.hatlestad
I was recently asked an question about an interesting use case. They wanted content to be submitted into UCM with a particular ID in a custom metadata field. But they wanted that ID to be translated during submission into an employee name in another metadata field upon submission.
My initial thought was that this could be done with a dependent choice list (DCL). One option list field driving the choices in another. But this didn't work in this case for a couple of reasons. First, the number of IDs could potentially be very large. So making that into a drop-down list would not be practical. The preference would be for that field to simply be a text field to type in the ID. Secondly, data could be submitted through different methods other then the web-based check-in form. And without an interface to select the DCL choices, the system needed a way to determine and populate the name field.
So instead I went the approach of having the value of the ID field drive the value of the Name field using the derived field approach in my rule. In looking at it though, it was easy to simply copy the value of the ID field into the Name field...but to have it look up and translate the value proved to be the tricky part.
So here is the approach I took...
First I created my two metadata fields as standard text fields in the Configuration Manager applet.
Next I create a table that stores the relationship between the IDs and Names.
I then create a View into that table and set the column to the EmployeeID.
I now create a new Application Field and set it as an option list using the View I created in the previous step.
The reason I create it as an Application field is because I don't need to display the field or store a value in it. I simply need to make use of the option list in the next step...
Finally, I create a Rule in which I select the Employee Name field and turn on the 'Is derived field' checkbox. I edit the derived value and add a new condition. Because the option list is a Application field and not an Information field, I can't use the Compute button. Instead, I insert this line directly in the Value field:
@getFieldViewValue("EmployeeMapping",#active.xEmployeeID, "EmployeeName")
The "EmployeeMapping" parameter designates that the value should be pulled from the EmployeeMapping Application field that I had created in the previous step. The #active.xEmployeeID field is the ID value that should be pulled from what the user entered. "EmployeeName" is the column name in the table which has the value which corresponds to the ID. The extracted name then becomes the value within our Employee Name field.
That's it. You can then add additional Rules to make the Name field read-only/hidden on the check-in page and such.