Skip to content
Snippets Groups Projects
Commit 0d2b2b2a authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

Merge branch 'cm_dt_1074525_kampagnenteilnehmer_hinzufügen' into '2021.0'

Cm dt 1074525 kampagnenteilnehmer hinzufügen

See merge request xrm/basic!702
parents 0bcd95a1 2e1b5bf4
No related branches found
No related tags found
No related merge requests found
......@@ -3,13 +3,20 @@ import("system.result");
import("system.vars");
if (vars.get("$sys.validationerrors"))
{
result.string(neon.COMPONENTSTATE_DISABLED);
else
}
else if(vars.get("$field.campaignparticipantContactIds") != null && vars.get("$field.campaignparticipantContactIds") != "")
{
var contactCount = JSON.parse(vars.get("$field.campaignparticipantContactIds")).length;
if (contactCount == 0)
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
}
\ No newline at end of file
......@@ -3,17 +3,22 @@ import("system.result");
import("Sql_lib");
import("system.translate");
let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param"));
if(participants.length > 0)
if (vars.get("$param.campaignParticipantsRowIds_param") != null && vars.get("$param.campaignParticipantsRowIds_param") != "")
{
let thisParticipantCount = newSelect("count('')").from("CAMPAIGNPARTICIPANT")
.where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID"))
.and(
"CAMPAIGNPARTICIPANT.CONTACT_ID",
participants,
SqlBuilder.IN()
).cell();
let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param"));
if(participants.length > 0)
{
let thisParticipantCount = newSelect("COUNT(*)")
.from("CAMPAIGNPARTICIPANT")
.where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID"))
.and("CAMPAIGNPARTICIPANT.CONTACT_ID", participants, SqlBuilder.IN())
.cell();
if(parseInt(thisParticipantCount) > 0)
result.string(translate.text("Participant is already participating"));
if(parseInt(thisParticipantCount) > 0)
{
result.string(translate.text("Participant is already participating"));
}
}
}
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