Problem in comparison logic
Hello team, I have a custom function called BuscaCandidatoxRutQA, which presents a simple logic, use COQL to search under a criterion if there is a person as a candidate in CRM, if there is, it returns their record id, otherwise it returns 0
- int BuscaCandidatoxRutQA(string rut)
- {
- queryMap = Map();
- queryMap.put("select_query","select Rut from Contacts where Rut = '" + rut + "'");
- response = invokeurl
- [
- url :"https://www.zohoapis.com/crm/v6/coql"
- type :POST
- parameters:queryMap.toString()
- connection:"coql_sandbox2023"
- ];
- info response;
- info response.get("code");
- if(response.get("code") == 'NO_SUCH_CRM_ACCOUNT' || length(response) == 0)
- {
- return 0;
- }
- else
- {
- return response.get("data").get(0).get("id").toLong();
- }
- }
I have a decision logic, which evaluates the output of the custom function BuscaCandidatoxRutQA, if the value is greater than 0 it indicates that that candidate exists in CRM, otherwise it does not exist.
The issue is that for some strange reason it does not do the comparison correctly and erroneously indicates that the candidate id 4229715000535783596 is not greater than zero, which is wrong.
I need a help please