A Pen by Robert Fridzema on CodePen.
Created
April 11, 2022 14:41
-
-
Save fridzema/faee446d3893b01c8c2e0bdaf34c3016 to your computer and use it in GitHub Desktop.
OJzwNZY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let output = {}; | |
const jobParameters = getParameters().variables.job_params; | |
const data = api.custom_objects.list_with_options( | |
"CompanyChains", | |
[ | |
"companychain", | |
"equal to", | |
jobParameters.data.domain.name.toUpperCase(), | |
"and", | |
"mmcomp", | |
"equal to", | |
jobParameters.data.management_company.toUpperCase() | |
], | |
[], | |
[], | |
{} | |
).results; | |
console.log(data); | |
output = { | |
clientcode: data[0]?.clientcode || "-", | |
site: data[0]?.site || "-", | |
sharename: data[0]?.sharename || "-", | |
structure: data[0]?.structure || "-" | |
}; | |
switch (output.site) { | |
case "Brabo": | |
output.uri = "beawp-cloudflow-acc"; | |
break; | |
case "Antwerp": | |
output.uri = "beawp-cloudflow"; | |
break; | |
case "Sofia": | |
output.uri = "bgsfa-cloudflow"; | |
break; | |
case "Capelle": | |
output.uri = "nlcpl-cloudflow"; | |
break; | |
} | |
console.log(output); | |
setResultVariables({ | |
client_codes: output.clientcode, | |
site: output.site, | |
share: output.share, | |
structure: output.structure, | |
webservice: `https://${output.uri}.tallongs.com/portal.cgi?` | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment