fix(dalpuri): populate locationId and fix closedFlag on opportunities
- Add ownerLevelRecId -> locationId mapping to opportunity translation - Include soOppStatus in opportunity query and derive closedFlag from status.closedFlag (with fallback to legacy oldCloseFlag field) - Add locationId sanitization guard in both sync.ts and sync-by-table.ts Note: departmentId is not available in CW SO_Opportunity table and remains null for synced records.
This commit is contained in:
@@ -442,6 +442,12 @@ const sanitizeModelData = (
|
||||
) {
|
||||
sanitized.statusId = null;
|
||||
}
|
||||
if (
|
||||
sanitized.locationId != null &&
|
||||
!context.corporateLocationIds.has(sanitized.locationId as number)
|
||||
) {
|
||||
sanitized.locationId = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (targetModel === "schedule") {
|
||||
@@ -750,6 +756,11 @@ const getConfigForTable = (table: string): SyncTableConfig | null => {
|
||||
secondarySalesFlag: true,
|
||||
},
|
||||
},
|
||||
soOppStatus: {
|
||||
select: {
|
||||
closedFlag: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user