I assume that both have a unique key so the 'Excel' object can be found or otherwise created from the Exclusivity_Data_Import. I also assume that both objects are already committed and stored in the database.
I would use "CopyAttributes" from marketplace CommunityCommons and align the attribute names(Case sensitive, e.g. EIS_AREA_MANAGER vs EIS_Area_Manager). However if the "Excel attribute" already has a value and Exclusivity_Data_Import attribute is empty you need a large change object action with expressions like (Assign attribute Excel.SOLDTOCITY)
if Exclusivity_Data_Import.SOLDTOCITY != empty and Exclusivity_Data_Import.SOLDTOCITY != '' then
Exclusivity_Data_Import.SOLDTOCITY
else
Excel.SOLDTOCITY
but that are many lines.
Alternative is to copy the javaAction CopyAttributes to your own Java action in your own module and modify it
if (source == null) {
throw new IllegalStateException("source is null");
}
if (target == null) {
throw new IllegalStateException("target is null");
}
for (IMetaPrimitive e : target.getMetaObject().getMetaPrimitives()) {
if (!source.hasMember(e.getName())) {
continue;
}
if (e.isVirtual() || e.getType() == PrimitiveType.AutoNumber) {
continue;
}
if ("__UUID__".equals(e.getName()) && (isFileDocument(source) || isFileDocument(target))) {
continue;
}
if (source.getValue(context, e.getName()) != null) {
target.setValue(context, e.getName(), source.getValue(context, e.getName()));
}
}
A few things come to mind:
1. It's tedious, but just put in the work to create a simple reusable microflows that will take in the updated exclusivity object as a parameter, and then use a unique identifier from the exclusivity object to retrieve it's corresponding excel object from the database and update the Excel object accordingly. It sounds like your exclusivity object is the source of truth here, so updating every attribute that corresponds to the exclusivity object each time shouldn't overwrite anything on the Excel object that shouldn't be overwritten.
2. A more hackier way to perform this sync would be to any time you want to perform the sync you could export the exclusivity object and create an import mapping where you consume the exclusivity object data into an Excel object. You could assign a key to the mapping so you are updating an existing Excel object if there is one.
3. Maybe not the most efficient, but you could look at the way the Audit Trail module tracks and reports on changes, and mimic/reuse some of the logic. Whenever the exclusivity object is changed you could use the same process as the audit trail to track and apply those changes to it's corresponding excel object on commit
Good luck!