diff --git a/const.hpp b/const.hpp
index 69c8107..6ab10e5 100644
--- a/const.hpp
+++ b/const.hpp
@@ -39,7 +39,9 @@
 static constexpr auto MB_HOUR_END = 13;
 static constexpr auto MB_MIN_END = 16;
 static constexpr auto SYSTEM_OBJECT = "/system/chassis/motherboard";
-static constexpr auto LOCATION_CODE_INF = "com.ibm.ipzvpd.Location";
+static constexpr auto IBM_LOCATION_CODE_INF = "com.ibm.ipzvpd.Location";
+static constexpr auto XYZ_LOCATION_CODE_INF =
+    "xyz.openbmc_project.Inventory.Decorator.LocationCode";
 constexpr int IPZ_DATA_START = 11;
 constexpr uint8_t KW_VAL_PAIR_START_TAG = 0x84;
 constexpr uint8_t RECORD_END_TAG = 0x78;
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index fed83ad..a678adb 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -207,11 +207,13 @@
                 if constexpr (is_same<T, Parsed>::value)
                 {
                     if (busProp == "LocationCode" &&
-                        inf == "com.ibm.ipzvpd.Location")
+                        inf == IBM_LOCATION_CODE_INF)
                     {
+                        // TODO deprecate the com.ibm interface later
                         auto prop = expandLocationCode(
                             itr.value().get<string>(), vpdMap, isSystemVpd);
                         props.emplace(busProp, prop);
+                        interfaces.emplace(XYZ_LOCATION_CODE_INF, props);
                     }
                     else
                     {
@@ -443,8 +445,7 @@
                     for (const auto& eI : itemEEPROM["extraInterfaces"].items())
                     {
                         inventory::PropertyMap props;
-                        if (eI.key() ==
-                            openpower::vpd::constants::LOCATION_CODE_INF)
+                        if (eI.key() == IBM_LOCATION_CODE_INF)
                         {
                             if constexpr (std::is_same<T, Parsed>::value)
                             {
diff --git a/test/vpd-manager-test/editor_test.cpp b/test/vpd-manager-test/editor_test.cpp
index 1549df8..de7e2ba 100644
--- a/test/vpd-manager-test/editor_test.cpp
+++ b/test/vpd-manager-test/editor_test.cpp
@@ -69,8 +69,9 @@
         for (const auto& itemEEPROM : groupEEPROM)
         {
             fruLocationCode.emplace(
-                itemEEPROM["extraInterfaces"][LOCATION_CODE_INF]["LocationCode"]
-                    .get_ref<const nlohmann::json::string_t&>(),
+                itemEEPROM["extraInterfaces"][IBM_LOCATION_CODE_INF]
+                          ["LocationCode"]
+                              .get_ref<const nlohmann::json::string_t&>(),
                 itemEEPROM["inventoryPath"]
                     .get_ref<const nlohmann::json::string_t&>());
         }
diff --git a/test/vpd-manager-test/reader_test.cpp b/test/vpd-manager-test/reader_test.cpp
index b6cf80c..58d8d2f 100644
--- a/test/vpd-manager-test/reader_test.cpp
+++ b/test/vpd-manager-test/reader_test.cpp
@@ -65,8 +65,9 @@
         for (const auto& itemEEPROM : groupEEPROM)
         {
             fruLocationCode.emplace(
-                itemEEPROM["extraInterfaces"][LOCATION_CODE_INF]["LocationCode"]
-                    .get_ref<const nlohmann::json::string_t&>(),
+                itemEEPROM["extraInterfaces"][IBM_LOCATION_CODE_INF]
+                          ["LocationCode"]
+                              .get_ref<const nlohmann::json::string_t&>(),
                 itemEEPROM["inventoryPath"]
                     .get_ref<const nlohmann::json::string_t&>());
         }
@@ -109,8 +110,8 @@
 {
     // mock the call to read bus property
     MockUtilCalls uCalls;
-    EXPECT_CALL(uCalls, readBusProperty("/system/chassis/motherboard",
-                                        LOCATION_CODE_INF, "LocationCode"))
+    EXPECT_CALL(uCalls, readBusProperty(SYSTEM_OBJECT, IBM_LOCATION_CODE_INF,
+                                        "LocationCode"))
         .Times(1)
         .WillOnce(testing::Return("U78DA.ND1.1234567-P0"));
 
diff --git a/vpd-manager/editor_impl.cpp b/vpd-manager/editor_impl.cpp
index df1441c..091d026 100644
--- a/vpd-manager/editor_impl.cpp
+++ b/vpd-manager/editor_impl.cpp
@@ -2,6 +2,7 @@
 
 #include "editor_impl.hpp"
 
+#include "common_utility.hpp"
 #include "ibm_vpd_utils.hpp"
 #include "ipz_parser.hpp"
 #include "parser_factory.hpp"
@@ -293,6 +294,7 @@
 
 void EditorImpl::processAndUpdateCI(const std::string& objectPath)
 {
+    inventory::ObjectMap objects;
     for (auto& commonInterface : jsonFile["commonInterfaces"].items())
     {
         for (auto& ciPropertyList : commonInterface.value().items())
@@ -305,21 +307,26 @@
                     (ciPropertyList.value().value("keywordName", "") ==
                      thisRecord.recKWd))
                 {
+                    inventory::PropertyMap prop;
+                    inventory::InterfaceMap interfaces;
                     std::string kwdData(thisRecord.kwdUpdatedData.begin(),
                                         thisRecord.kwdUpdatedData.end());
 
-                    makeDbusCall<std::string>((INVENTORY_PATH + objectPath),
-                                              commonInterface.key(),
-                                              ciPropertyList.key(), kwdData);
+                    prop.emplace(ciPropertyList.key(), move(kwdData));
+                    interfaces.emplace(commonInterface.key(), move(prop));
+                    objects.emplace(objectPath, move(interfaces));
                 }
             }
         }
     }
+    // Notify PIM
+    common::utility::callPIM(move(objects));
 }
 
 void EditorImpl::processAndUpdateEI(const nlohmann::json& Inventory,
                                     const inventory::Path& objPath)
 {
+    inventory::ObjectMap objects;
     for (const auto& extraInterface : Inventory["extraInterfaces"].items())
     {
         if (extraInterface.value() != NULL)
@@ -334,18 +341,23 @@
                         ((eiPropertyList.value().value("keywordName", "") ==
                           thisRecord.recKWd)))
                     {
+                        inventory::PropertyMap prop;
+                        inventory::InterfaceMap interfaces;
                         std::string kwdData(thisRecord.kwdUpdatedData.begin(),
                                             thisRecord.kwdUpdatedData.end());
-                        makeDbusCall<std::string>(
-                            (INVENTORY_PATH + objPath), extraInterface.key(),
-                            eiPropertyList.key(),
-                            encodeKeyword(kwdData, eiPropertyList.value().value(
-                                                       "encoding", "")));
+                        encodeKeyword(kwdData, eiPropertyList.value().value(
+                                                   "encoding", ""));
+
+                        prop.emplace(eiPropertyList.key(), move(kwdData));
+                        interfaces.emplace(extraInterface.key(), move(prop));
+                        objects.emplace(objPath, move(interfaces));
                     }
                 }
             }
         }
     }
+    // Notify PIM
+    common::utility::callPIM(move(objects));
 }
 
 void EditorImpl::updateCache()
@@ -353,9 +365,12 @@
     const std::vector<nlohmann::json>& groupEEPROM =
         jsonFile["frus"][vpdFilePath].get_ref<const nlohmann::json::array_t&>();
 
+    inventory::ObjectMap objects;
     // iterate through all the inventories for this file path
     for (const auto& singleInventory : groupEEPROM)
     {
+        inventory::PropertyMap prop;
+        inventory::InterfaceMap interfaces;
         // by default inherit property is true
         bool isInherit = true;
         bool isInheritEI = true;
@@ -386,11 +401,13 @@
             // For CPU- update  com interface only when isCI true
             if ((!isCpuModuleOnly) || (isCpuModuleOnly && isCI))
             {
-                makeDbusCall<Binary>(
-                    (INVENTORY_PATH +
-                     singleInventory["inventoryPath"].get<std::string>()),
+                prop.emplace(thisRecord.recKWd, thisRecord.kwdUpdatedData);
+                interfaces.emplace(
                     (IPZ_INTERFACE + (std::string) "." + thisRecord.recName),
-                    thisRecord.recKWd, thisRecord.kwdUpdatedData);
+                    move(prop));
+                objects.emplace(
+                    (singleInventory["inventoryPath"].get<std::string>()),
+                    move(interfaces));
             }
 
             // process Common interface
@@ -402,11 +419,13 @@
         {
             if (isCpuModuleOnly)
             {
-                makeDbusCall<Binary>(
-                    (INVENTORY_PATH +
-                     singleInventory["inventoryPath"].get<std::string>()),
+                prop.emplace(thisRecord.recKWd, thisRecord.kwdUpdatedData);
+                interfaces.emplace(
                     (IPZ_INTERFACE + (std::string) "." + thisRecord.recName),
-                    thisRecord.recKWd, thisRecord.kwdUpdatedData);
+                    move(prop));
+                objects.emplace(
+                    (singleInventory["inventoryPath"].get<std::string>()),
+                    move(interfaces));
             }
 
             // process extra interfaces
@@ -415,6 +434,8 @@
                                    .get_ref<const nlohmann::json::string_t&>());
         }
     }
+    // Notify PIM
+    common::utility::callPIM(move(objects));
 }
 
 void EditorImpl::expandLocationCode(const std::string& locationCodeType)
@@ -439,28 +460,35 @@
 
     const nlohmann::json& groupFRUS =
         jsonFile["frus"].get_ref<const nlohmann::json::object_t&>();
+    inventory::ObjectMap objects;
+
     for (const auto& itemFRUS : groupFRUS.items())
     {
         const std::vector<nlohmann::json>& groupEEPROM =
             itemFRUS.value().get_ref<const nlohmann::json::array_t&>();
         for (const auto& itemEEPROM : groupEEPROM)
         {
+            inventory::PropertyMap prop;
+            inventory::InterfaceMap interfaces;
+            const auto& objectPath = itemEEPROM["inventoryPath"];
+            sdbusplus::message::object_path object(objectPath);
+
             // check if the given item implements location code interface
-            if (itemEEPROM["extraInterfaces"].find(LOCATION_CODE_INF) !=
+            if (itemEEPROM["extraInterfaces"].find(IBM_LOCATION_CODE_INF) !=
                 itemEEPROM["extraInterfaces"].end())
             {
                 const std::string& unexpandedLocationCode =
-                    itemEEPROM["extraInterfaces"][LOCATION_CODE_INF]
+                    itemEEPROM["extraInterfaces"][IBM_LOCATION_CODE_INF]
                               ["LocationCode"]
                                   .get_ref<const nlohmann::json::string_t&>();
                 std::size_t idx = unexpandedLocationCode.find(locationCodeType);
                 if (idx != std::string::npos)
                 {
-                    std::string expandedLoctionCode(unexpandedLocationCode);
+                    std::string expandedLocationCode(unexpandedLocationCode);
 
                     if (locationCodeType == "fcs")
                     {
-                        expandedLoctionCode.replace(
+                        expandedLocationCode.replace(
                             idx, 3,
                             propertyFCorTM.substr(0, 4) + ".ND0." + propertySE);
                     }
@@ -468,20 +496,22 @@
                     {
                         std::replace(propertyFCorTM.begin(),
                                      propertyFCorTM.end(), '-', '.');
-                        expandedLoctionCode.replace(
+                        expandedLocationCode.replace(
                             idx, 3, propertyFCorTM + "." + propertySE);
                     }
 
-                    // update the DBUS interface
-                    makeDbusCall<std::string>(
-                        (INVENTORY_PATH +
-                         itemEEPROM["inventoryPath"]
-                             .get_ref<const nlohmann::json::string_t&>()),
-                        LOCATION_CODE_INF, "LocationCode", expandedLoctionCode);
+                    // update the DBUS interface COM as well as XYZ path
+                    prop.emplace("LocationCode", expandedLocationCode);
+                    // TODO depricate this com.ibm interface later
+                    interfaces.emplace(IBM_LOCATION_CODE_INF, prop);
+                    interfaces.emplace(XYZ_LOCATION_CODE_INF, move(prop));
                 }
             }
+            objects.emplace(move(object), move(interfaces));
         }
     }
+    // Notify PIM
+    common::utility::callPIM(move(objects));
 }
 
 string EditorImpl::getSysPathForThisFruType(const string& moduleObjPath,
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 42b1bbd..829dce8 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -87,11 +87,11 @@
                              .get_ref<const nlohmann::json::string_t&>(),
                          std::make_pair(itemFRUS.key(), isMotherboard));
 
-            if (itemEEPROM["extraInterfaces"].find(LOCATION_CODE_INF) !=
+            if (itemEEPROM["extraInterfaces"].find(IBM_LOCATION_CODE_INF) !=
                 itemEEPROM["extraInterfaces"].end())
             {
                 fruLocationCode.emplace(
-                    itemEEPROM["extraInterfaces"][LOCATION_CODE_INF]
+                    itemEEPROM["extraInterfaces"][IBM_LOCATION_CODE_INF]
                               ["LocationCode"]
                                   .get_ref<const nlohmann::json::string_t&>(),
                     itemEEPROM["inventoryPath"]
diff --git a/vpd-manager/reader_impl.cpp b/vpd-manager/reader_impl.cpp
index 08eb32b..b1f16b1 100644
--- a/vpd-manager/reader_impl.cpp
+++ b/vpd-manager/reader_impl.cpp
@@ -75,7 +75,7 @@
     utility utilObj;
 #endif
     expandedLocationCode = utilObj.readBusProperty(
-        iterator->second, LOCATION_CODE_INF, "LocationCode");
+        iterator->second, IBM_LOCATION_CODE_INF, "LocationCode");
     return expandedLocationCode;
 }
 
