From e9857964ad56483051ecdbe64cd8b38ab8751642 Mon Sep 17 00:00:00 2001 From: Andre Colle Date: Wed, 8 Jan 2025 19:04:38 +0100 Subject: [PATCH 1/2] Added values for new fields in KafkaEnhet integration New fields INT_EmployerEmail__c, INT_EmployerMobilePhone__c, Phone and CRM_NumberOfEmployeesGrouped__c --- force-app/ereg-handler/classes/KafkaEnhet.cls | 3 ++ .../classes/KafkaEnhetHandler.cls | 40 +++++++++++++++++++ sfdx-project.json | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/force-app/ereg-handler/classes/KafkaEnhet.cls b/force-app/ereg-handler/classes/KafkaEnhet.cls index 851f75bf..49c9a855 100644 --- a/force-app/ereg-handler/classes/KafkaEnhet.cls +++ b/force-app/ereg-handler/classes/KafkaEnhet.cls @@ -22,6 +22,9 @@ public with sharing class KafkaEnhet { public String maalform; public String overordnetEnhet; public String hjemmeside; + public String epostadresse; + public String telefon; + public String mobil; public class Organisasjonsform { public String kode; diff --git a/force-app/ereg-handler/classes/KafkaEnhetHandler.cls b/force-app/ereg-handler/classes/KafkaEnhetHandler.cls index 4705c812..d0da0ad7 100644 --- a/force-app/ereg-handler/classes/KafkaEnhetHandler.cls +++ b/force-app/ereg-handler/classes/KafkaEnhetHandler.cls @@ -143,6 +143,11 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer acc.INT_Industry3__c = org.Naeringskode3 != null ? org.Naeringskode3.beskrivelse : null; acc.INT_Sector__c = org.institusjonellSektorkode != null ? org.institusjonellSektorkode.beskrivelse : null; acc.INT_SectorCode__c = org.institusjonellSektorkode != null ? org.institusjonellSektorkode.kode : null; + acc.INT_EmployerEmail__c = org.epostadresse; + acc.INT_EmployerMobilePhone__c = org.mobil; + acc.Phone = org.telefon; + acc.CRM_NumberOfEmployeesGrouped__c = getNumberOfEmployeesGroup(org.antallAnsatte, org.harRegistrertAntallAnsatte); + // Reset if employers are falsely set to deleted acc.IsDeletedEmployer__c = false; acc.EmployerDeletedDate__c = null; @@ -239,4 +244,39 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer CRM_ApplicationDomain.Domain.POAB // Domain domain ); } + + + /** + * @description Method that returns a group value of employees based on the number of employees registered by a company + * + * @author Andre Colle + * @since 2025-01-08 Created. + * + * @param numberOfEmployees Contains the number of employees registered by the employer + * @param hasRegisteredEmployees Contains boolean value that indicates if the employer har registered any employees + * @return Group of number of employees. + */ + private static String getNumberOfEmployeesGroup(Integer numberOfEmployees, Boolean hasRegisteredEmployees) { + if (numberOfEmployees <= 4 && hasRegisteredEmployees == true) { + return '1-4'; + } else if (numberOfEmployees >= 5 && numberOfEmployees <= 10) { + return '5-10'; + } else if (numberOfEmployees >= 11 && numberOfEmployees <= 25) { + return '11-25'; + } else if (numberOfEmployees >= 26 && numberOfEmployees <= 50) { + return '26-50'; + } else if (numberOfEmployees >= 51 && numberOfEmployees <= 100) { + return '51-100'; + } else if (numberOfEmployees >= 101 && numberOfEmployees <= 250) { + return '101-250'; + } else if (numberOfEmployees >= 251 && numberOfEmployees <= 500) { + return '251-500'; + } else if (numberOfEmployees >= 501 && numberOfEmployees <= 1000) { + return '501-1000'; + } else if (numberOfEmployees >= 1001) { + return '1000+'; + } else { + return null; + } + } } diff --git a/sfdx-project.json b/sfdx-project.json index 13d77be4..0bef2a1c 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -8,7 +8,7 @@ "dependencies": [ { "package": "crm-platform-base", - "versionNumber": "0.245.0.LATEST" + "versionNumber": "0.249.0.LATEST" }, { "package": "crm-shared-flowComponents", From 3540843929acfbe66007d5d6a63510784bdcbc36 Mon Sep 17 00:00:00 2001 From: Andre Colle Date: Wed, 8 Jan 2025 19:44:46 +0100 Subject: [PATCH 2/2] Set variable type as decimal --- force-app/ereg-handler/classes/KafkaEnhetHandler.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/ereg-handler/classes/KafkaEnhetHandler.cls b/force-app/ereg-handler/classes/KafkaEnhetHandler.cls index d0da0ad7..7ce7e313 100644 --- a/force-app/ereg-handler/classes/KafkaEnhetHandler.cls +++ b/force-app/ereg-handler/classes/KafkaEnhetHandler.cls @@ -256,7 +256,7 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer * @param hasRegisteredEmployees Contains boolean value that indicates if the employer har registered any employees * @return Group of number of employees. */ - private static String getNumberOfEmployeesGroup(Integer numberOfEmployees, Boolean hasRegisteredEmployees) { + private static String getNumberOfEmployeesGroup(Decimal numberOfEmployees, Boolean hasRegisteredEmployees) { if (numberOfEmployees <= 4 && hasRegisteredEmployees == true) { return '1-4'; } else if (numberOfEmployees >= 5 && numberOfEmployees <= 10) {