Problem in comparison logic

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

  1. int BuscaCandidatoxRutQA(string rut)
  2. {
  3. queryMap = Map();
  4. queryMap.put("select_query","select Rut from Contacts where Rut = '" + rut + "'");
  5. response = invokeurl
  6. [
  7. url :"https://www.zohoapis.com/crm/v6/coql"
  8. type :POST
  9. parameters:queryMap.toString()
  10. connection:"coql_sandbox2023"
  11. ];
  12. info response;
  13. info response.get("code");
  14. if(response.get("code") == 'NO_SUCH_CRM_ACCOUNT' || length(response) == 0)
  15. {
  16. return 0;
  17. }
  18. else
  19. {
  20. return response.get("data").get(0).get("id").toLong();
  21. }
  22. }






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