Skip to content
Snippets Groups Projects
Commit 932aafbb authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Lead import use Sql builder

parent c4192c8c
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,9 @@ import("system.vars");
import("Sql_lib");
import("system.db");
var contactId = db.cell(SqlCondition.begin()
.andPrepare("CONTACT.PERSON_ID", vars.get("$field.LEAD_PERSON"))
.buildSql("select CONTACTID from CONTACT", "1=2"));
var contactId = newSelect("CONTACTID")
.from("CONTACT")
.whereIfSet("CONTACT.PERSON_ID", "$field.LEAD_PERSON")
.cell(true);
result.string(contactId);
\ No newline at end of file
......@@ -6,13 +6,14 @@ import("system.db");
var contactId = "";
if(vars.get("$field.LEAD_PERSON"))
contactId = db.cell(SqlCondition.begin()
.andPrepare("CONTACT.PERSON_ID", vars.get("$field.LEAD_PERSON"))
.buildSql("select CONTACTID from CONTACT", "1=2"));
contactId = newSelect("CONTACTID")
.from("CONTACT")
.whereIfSet("CONTACT.PERSON_ID", "$field.LEAD_PERSON")
.cell(true);
else
contactId = db.cell(SqlCondition.begin()
.andPrepare("CONTACT.ORGANISATION_ID", vars.get("$field.LEAD_ORGANISATIONID"))
.buildSql("select CONTACTID from CONTACT", "1=2"));
contactId = newSelect("CONTACTID")
.from("CONTACT")
.whereIfSet("CONTACT.ORGANISATION_ID", "$field.LEAD_ORGANISATIONID")
.cell(true);
result.string(contactId);
\ 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