Skip to content
Snippets Groups Projects
Commit 27f9d66a authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch 'sales_2001680_salesproject_ondbdelete_references_cleanup' into '2021.2'

[Projekt: xRM-Sales][TicketNr.: 2001680][Checklistentryvalues werden beim...

See merge request xrm/basic!1485
parents 1da61258 ddf7cdc0
No related branches found
No related tags found
No related merge requests found
......@@ -9,45 +9,35 @@ var currentId = vars.getString("$field.SALESPROJECTID");
if (currentId)
{
var toDelete = [
"SALESPROJECT_MILESTONE",
"SALESPROJECT_TOUCHPOINT",
"CLASSIFICATIONSTORAGE"
var directRefTables = [
"SALESPROJECT_MILESTONE",
"SALESPROJECT_TOUCHPOINT"
];
var objectTypeRefTables = [
"CLASSIFICATION",
"CLASSIFICATIONSTORAGE",
"COMPETITION",
"OBJECTMEMBER",
"FORECAST",
"CHECKLISTENTRYVALUE"
];
toDelete = toDelete.map(function(pTable)
var deleteStatements = [];
directRefTables.forEach(function(pTable)
{
var cond;
if(pTable != "CLASSIFICATIONSTORAGE")
cond = newWhere(pTable + ".SALESPROJECT_ID", currentId)
else
cond = newWhere(pTable + ".OBJECT_ROWID", currentId)
return [pTable, cond.build()];
var cond = newWhere(pTable + ".SALESPROJECT_ID", currentId);
deleteStatements.push([pTable, cond.build()]);
});
var modulesToDelete = [
"CLASSIFICATION",
"COMPETITION",
"OBJECTMEMBER",
"FORECAST"
];
toDelete = toDelete.concat(modulesToDelete.map(function(pTableComp)
objectTypeRefTables.forEach(function(pTable)
{
var cond = newWhere(pTableComp + ".OBJECT_TYPE", ContextUtils.getCurrentContextId())
.and(pTableComp + ".OBJECT_ROWID", currentId)
return [pTableComp, cond.build()];
}));
db.deletes(toDelete);
var cond = newWhere(pTable + ".OBJECT_TYPE", ContextUtils.getCurrentContextId())
.and(pTable + ".OBJECT_ROWID", currentId)
deleteStatements.push([pTable, cond.build()]);
});
db.deletes(deleteStatements);
}
new AttributeRelationQuery(currentId, null, ContextUtils.getCurrentContextId())
.deleteAllAttributes();
WorkflowSignalSender.deleted();
\ No newline at end of file
WorkflowSignalSender.deleted();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment