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

1069470 Fix attributes of SourceContact now gets preset when creating new function

parent 9020d433
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
<grantUpdateProcess>%aditoprj%/entity/Contact_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/Contact_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/Contact_entity/contentTitleProcess.js</contentTitleProcess>
<afterUiInit>%aditoprj%/entity/Contact_entity/afterUiInit.js</afterUiInit>
<onValidation>%aditoprj%/entity/Contact_entity/onValidation.js</onValidation>
<initFilterProcess>%aditoprj%/entity/Contact_entity/initFilterProcess.js</initFilterProcess>
<iconId>VAADIN:USERS</iconId>
......@@ -258,6 +259,11 @@
<entityConsumer>
<name>Attributes</name>
<onValidation>%aditoprj%/entity/Contact_entity/entityfields/attributes/onValidation.js</onValidation>
<dependency>
<name>dependency</name>
<entityName>AttributeRelation_entity</entityName>
<fieldName>AttributeRelations</fieldName>
</dependency>
<children>
<entityParameter>
<name>ShowDsgvoMessage_param</name>
......@@ -273,11 +279,6 @@
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
<dependency>
<name>dependency</name>
<entityName>AttributeRelation_entity</entityName>
<fieldName>AttributeRelations</fieldName>
</dependency>
</entityConsumer>
</entityFields>
<recordContainers>
......
import("Sql_lib");
import("system.neon");
import("system.vars");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
{
var personId = vars.get("$param.PersonId_param");
var contactId = vars.get("$param.OwnContactId_param");
if(personId && contactId)
{
var attributes = newSelect("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID, " + SqlBuilder.caseStatement()
.when(newWhere("AB_ATTRIBUTERELATION.ID_VALUE is null").and("AB_ATTRIBUTERELATION.CHAR_VALUE is null"))
.then("cast(NUMBER_VALUE as CHAR)")
.when(newWhere("AB_ATTRIBUTERELATION.NUMBER_VALUE is null").and("AB_ATTRIBUTERELATION.CHAR_VALUE is null"))
.then("ID_VALUE")
.when(newWhere("AB_ATTRIBUTERELATION.NUMBER_VALUE is null").and("AB_ATTRIBUTERELATION.ID_VALUE is null"))
.then("CHAR_VALUE")
.toString())
.from("AB_ATTRIBUTERELATION")
.where("AB_ATTRIBUTERELATION.OBJECT_ROWID", contactId)
.table();
for (i = 0; i < attributes.length; i++) {
neon.addRecord("Attributes", {
"AB_ATTRIBUTE_ID" : attributes[i][0],
"VALUE" : attributes[i][1]
});
}
}
}
\ No newline at end of file
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