Org hierarchy field

The Org hierarchy field (a_org_hierarchy) contains a JSON element that is the org hierarchy data of the unit associated with the survey when the record was created. This field is not directly editable, but it can be displayed in reports or in exports, and it is useful for debugging.

Mapping of a the fields in a Unit and the values in a UNit group, to the JSON in a_org_hierarchy

Important: For each unit field in Medallia Experience Cloud, the survey record has a corresponding system E-field that contains the organization (Unit group) data. These fields cannot be displayed in reporting but they are editable and are what is used to populate the Org hierarchy field. For example, if in addition to the Unit ID field there is another unit field named e_myunitfield, the corresponding editable field with the unit data are e_unitid_org_hierarchy and e_myunitfield_org_hierarchy, respectively. These system E-fields contain a list of all the unit groups tied to that record for each unit.

The following sections describe how to use import specifications to update the persistent data stored in the field.

Warning: Test these procedures in a sandbox instance first. There is no way to undo these operations if the results are undesirable. For more information, see Sandboxes.

Matching the current Org hierarchy

To update records to match the current org hierarchy, use the fact that importer automatically populates the Org hierarchy field with the current hierarchy data when the field is empty. This procedure uses an import specification that first sets the field value to null, and then inserts that current hierarchy.

This Auto Importer specification performs a two-stacked operation on the same unit field (in this example the field is e_unitd). To update multiple fields, create mappings for each.

<?xml version="1.0" encoding="UTF-8"?>
<!-- This AI spec is used to overwrite the full hierarchy data on a survey record with the hierarchy data
tied to that unit in the current org. This is sometimes needed when Org Hierarchy Filtering is enabled
and you need to make a one time update to update the record-level hierarchy data -->
<import-spec columnsCheck="ALLOW_EXTRA_COLUMNS" name="SURVEY UPDATE - Org Hierarchy Update" description="An spec to update Surveys">
   <input-column heading="Surveyid for internal use (e.g. RI link)" />
   <input-column heading="e_unitid" />
   <output-column-group pluginName="Survey" recordUpdateMode="UPDATE">
      <output-column>
         <input-column heading="Surveyid for internal use (e.g. RI link)" />
         <target-field fieldId="surveyid" fieldName="Survey ID" requiredness="REQUIRED_USED_FOR_DUPLICATE_CHECK" type="INTEGER" />
      </output-column>
      <!-- In order to overwrite the full hierarchy data with hierarchy data in the current org,
          you first need to null out the unit field -->
      <output-column>
         <target-field fieldId="e_unitid" fieldName="Unit" requiredness="OPTIONAL" type="UNIT">
            <enumerated-field-parse-options mappingKey="IDENTIFIER" />
            <javascript-transform><![CDATA[return null;]]></javascript-transform>
         </target-field>
      </output-column>
   </output-column-group>
   <output-column-group pluginName="Survey" recordUpdateMode="UPDATE">
      <output-column>
         <input-column heading="Surveyid for internal use (e.g. RI link)" />
         <target-field fieldId="surveyid" fieldName="Survey ID" requiredness="REQUIRED_USED_FOR_DUPLICATE_CHECK" type="INTEGER" />
      </output-column>
      <!-- Then remap the same unit identifier to the unit field. This will then tie all the org data in the current org to the    record -->
      <output-column>
         <input-column heading="e_unitid" />
         <target-field fieldId="e_unitid" fieldName="Unit" requiredness="OPTIONAL" type="UNIT">
            <enumerated-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
   </output-column-group>
</import-spec>

Adding a specific Unit group using the record-level data

To add a specific Unit group to all records in the update for two Unit fields (e_unitid and e_myunitfield), append a constant value for the multiValuedMode argument (<target-field ... multiValueMode="APPEND" ... />) to the system org Event as shown in the following Auto Importer specification. You can also use another input-column and map that to the org Event fields if the values are not constant.

<?xml version="1.0" encoding="UTF-8"?>
<import-spec columnsCheck="ALLOW_EXTRA_COLUMNS" name="SURVEY UPDATE - Org Hierarchy Update" description="An spec to update Surveys">
   <input-column heading="Surveyid for internal use (e.g. RI link)" />
   <output-column-group pluginName="Survey" recordUpdateMode="UPDATE">
      <output-column>
         <input-column heading="Surveyid for internal use (e.g. RI link)" />
         <target-field fieldId="surveyid" fieldName="Survey ID" requiredness="REQUIRED_USED_FOR_DUPLICATE_CHECK" type="INTEGER" />
      </output-column>
      <!-- You can update the Unit group information tied to e_unitid for each record. Be sure to add a null check. -->
      <output-column>
         <constant value="identifier_of_unit_group_being_added" />
         <target-field fieldId="e_unitid_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="APPEND" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
	    <javascript-transform><![CDATA[if (hasContent(text(original.e_unitid))) return value;
			return null;]]></javascript-transform>
</target-field>
      </output-column>
      <!-- You can update the Unit group information for any unit field in Experience Cloud. Be sure to add a null check. -->
      <output-column>
         <constant value="identifier_of_unit_group_being_added" />
         <target-field fieldId="e_myunitfield_org_hierarchy" fieldName="My Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="APPEND" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
            <javascript-transform><![CDATA[if (hasContent(text(original.e_myunitfield))) return value;
                        return null;]]></javascript-transform>
         </target-field>
      </output-column>
   </output-column-group>
</import-spec>

Removing a specific Unit group using the record-level data

To remove a specific unit group from the record-level org data for two unit fields (e_unitid and e_myunitfield), use REMOVE instead of APPEND for the multiValuedMode argument (<target-field ... multiValueMode="REMOVE" ... />). For example:

<?xml version="1.0" encoding="UTF-8"?>
<output-column>
   <constant value="identifier_of_unit_group_being_removed" />
   <target-field fieldId="e_unitid_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="REMOVE" type="UNIT_GROUP">
      <unit-group-field-parse-options mappingKey="IDENTIFIER" />
   </target-field>
</output-column>

Updating persistent Unit group data using the record-level data

To overwrite all the persistent data tied to a record with org data in the feed file, use SYNC for the multiValuedMode argument (<target-field ... multiValueMode="SYNC" ... />). This is common when importing historical data when Org hierarchy filtering is enabled.

For example, if the organization has 3 levels (District, Region, Area) and you need to update all the record-level data for your two Unit fields (e_unitid and e_myunitifield), use this Auto Importer specification:

<?xml version="1.0" encoding="UTF-8"?>
<import-spec columnsCheck="ALLOW_EXTRA_COLUMNS" name="SURVEY UPDATE - Org Hierarchy Update" description="An spec to update Surveys">
   <input-column heading="Surveyid for internal use (e.g. RI link)" />
   <input-column heading="district_identifier" />
   <input-column heading="region_identifier" />
   <input-column heading="area_identifier" />
   <output-column-group pluginName="Survey" recordUpdateMode="UPDATE">
      <output-column>
         <input-column heading="Surveyid for internal use (e.g. RI link)" />
         <target-field fieldId="surveyid" fieldName="Survey ID" requiredness="REQUIRED_USED_FOR_DUPLICATE_CHECK" type="INTEGER" />
      </output-column>
      <!-- You can update the unit group information tied to e_unitid for each record -->
      <output-column>
         <input-column heading="district_identifier" />
         <target-field fieldId="e_unitid_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
      <output-column>
         <input-column heading="region_identifier" />
         <target-field fieldId="e_unitid_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
      <output-column>
         <input-column heading="area_identifier" />
         <target-field fieldId="e_unitid_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
      <!-- You can update the unit group information for any unit field in the system -->
      <output-column>
         <input-column heading="district_identifier" />
         <target-field fieldId="e_myunitfield_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
      <output-column>
         <input-column heading="region_identifier" />
         <target-field fieldId="e_myunitfield_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
      <output-column>
         <input-column heading="area_identifier" />
         <target-field fieldId="e_myunitfield_org_hierarchy" fieldName="Unit (Org Hierarchy)" requiredness="REQUIRED" multiValuedMode="SYNC" type="UNIT_GROUP">
            <unit-group-field-parse-options mappingKey="IDENTIFIER" />
         </target-field>
      </output-column>
   </output-column-group>
</import-spec>