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

Merge branch 'sales_pn_1080452_salesproject_autoprobab_notheigher' into '2021.1'

[Projekt: xRM-Sales][TicketNr.: 1080452][Automatische Wahrscheinlichkeit soll...

See merge request xrm/basic!949

(cherry picked from commit 365d67bd)

bdb10a19 [Projekt: xRM-Sales][TicketNr.: 1080452][Automatische Wahrscheinlichkeit soll...
6806bbb2 merged 2021.1 into sales_pn_1080452_salesproject_autoprobab_notheigher
9ce8032a [Projekt: xRM-Sales][TicketNr.: 1080452][Automatische Wahrscheinlichkeit soll...
parent 505fe5e4
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
<mandatory v="true" /> <mandatory v="true" />
<state>EDITABLE</state> <state>EDITABLE</state>
<displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/phase/displayValueProcess.js</displayValueProcess> <displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/phase/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Salesproject_entity/entityfields/phase/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
</onValueChangeTypes>
</entityField> </entityField>
<entityField> <entityField>
<name>PROJECTCODE</name> <name>PROJECTCODE</name>
......
import("Sql_lib");
import("system.neon");
import("system.vars");
var currPobab = parseInt(
newSelect("SALESPROJECT.PROBABILITY")
.from("SALESPROJECT")
.where("SALESPROJECT.SALESPROJECTID", vars.get("$field.SALESPROJECTID"))
.cell()
);
var autoProbab = parseInt(
newSelect("SALESPROJECTPHASEDEFINITION.AUTOPROBABILITY")
.from("SALESPROJECTPHASEDEFINITION")
.where("SALESPROJECTPHASEDEFINITION.PHASE", vars.get("$this.value"))
.cell()
);
if(isNaN(autoProbab) || autoProbab < currPobab)
{
neon.setFieldValue("$field.PROBABILITY", currPobab);
}
else
{
neon.setFieldValue("$field.PROBABILITY", autoProbab);
}
...@@ -22,17 +22,6 @@ vars.get("$local.changed").forEach(function(fieldName) { ...@@ -22,17 +22,6 @@ vars.get("$local.changed").forEach(function(fieldName) {
switch (fieldName) { switch (fieldName) {
case "SALESPROJECT.PHASE": case "SALESPROJECT.PHASE":
typeValue = "SalesprojectPhase";
var autoProbab = newSelect("SALESPROJECTPHASEDEFINITION.AUTOPROBABILITY")
.from("SALESPROJECTPHASEDEFINITION")
.where("SALESPROJECTPHASEDEFINITION.PHASE", vars.get("$field.PHASE")).cell();
if(!isNaN(parseInt(autoProbab)))
{
newWhere("SALESPROJECT.SALESPROJECTID", vars.get("$field.SALESPROJECTID"))
.updateFields({
"PROBABILITY": autoProbab
}, "SALESPROJECT");
}
break; break;
case "SALESPROJECT.STATUS": case "SALESPROJECT.STATUS":
// Milestone // Milestone
......
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