Skip to content

Instantly share code, notes, and snippets.

@fridzema
Created April 11, 2022 14:42
Show Gist options
  • Save fridzema/99f160b6da369a4e316c555694b47898 to your computer and use it in GitHub Desktop.
Save fridzema/99f160b6da369a4e316c555694b47898 to your computer and use it in GitHub Desktop.
OJzwNZY
let output = {};
const jobParameters = getParameters().variables.job_params;
console.log(jobParameters);
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