• Gabriel Mocelin
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hi guys, I was wondering how to show a custom field in the search field instead of the "Name" field. As you can see in the image below, I use automatic numbering for the "Name" field (changing to text is not an option) and then I wanted to show another field instead.
User-added image


 
Hi!

I'm trying to make an API call to populate some fields on a visual force page, but I'm catching this problem, does anyone have any idea what it could be?

System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY> at line 31.
 
public with sharing class pocAuthorizationManagement {
	
    public String email{get;set;}
    public String id_json{get;set;}
    public String inserted_at{get;set;}
    public String mobile_phone{get;set;}
    public String person_id{get;set;}
    public String term_id{get;set;}
    public String ip{get;set;}
    public String user_agent{get;set;}
    
    
    public pocAuthorizationManagement(ApexPages.StandardController stdController){
      
        Lead lead = (Lead)stdController.getRecord();
        lead = [SELECT Id, CPFTxt__c FROM Lead WHERE Id =: lead.Id];
        
        String leadCPF = lead.CPFTxt__c;
        
        String requestEndPoint = 'my-end-point;
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(requestEndPoint);
        request.setMethod('GET');
        HttpResponse response =  http.send(request);
        
        if(response.getStatusCode() ==  200){
            Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(response.getBody());
            System.debug(results);
            Map<String, Object> dataResults = (Map<String, Object>)(results.get('data'));
            email = String.valueOf(dataResults.get('email'));
            id_json = String.valueOf(dataResults.get('id'));
            inserted_at = String.valueOf(dataResults.get('inserted_at'));
            person_id = String.valueOf(dataResults.get('person_id'));
            mobile_phone = String.valueOf(dataResults.get('mobile_phone'));
            term_id = String.valueOf(dataResults.get('term_id'));
            
            Map<String, Object> sessionResults = (Map<String, Object>)(dataResults.get('session_metadata'));
            ip = String.valueOf(dataResults.get('ip'));
            user_agent = String.valueOf(dataResults.get('user_agent'));
            
        } else {
        	ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Algo de errado não está certo');
            ApexPages.addMessage(msg);
        }
   
    }

}
Exemple of my JSON.
{
   "data":[
      {
         "email":null,
         "id":"e729f678-8793-4793-a50a-2ad85b221139",
         "inserted_at":"2019-05-10T18:16:46",
         "mobile_phone":null,
         "person_id":"5557e08f-b569-47b9-993c-29fb85830724",
         "session_metadata":{
            "ip":"xxx",
            "user_agent":"{\"OS\": \"Android\", \"ip\": \"xxx\", \"Vendor\": \"Google Inc.\", \"AppName\": \"Netscape\", \"Browser\": \"Chrome\", \"OSVersion\": 9, \"Plataform\": \"Linux armv8l\", \"UserAgent\": \"Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"AppVersion\": \"5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"BrowserVersion\": 63.03239111}"
         },
         "term_id":"a174ac7e-be49-4ab2-8539-83e85367b866"
      },
      {
         "email":null,
         "id":"c7cec531-4057-4684-a6b9-6422e5138b9d",
         "inserted_at":"2019-05-10T18:16:46",
         "mobile_phone":null,
         "person_id":"5557e08f-b569-47b9-993c-29fb85830724",
         "session_metadata":{
            "ip":"xxx",
            "user_agent":"{\"OS\": \"Android\", \"ip\": \"xxx\", \"Vendor\": \"Google Inc.\", \"AppName\": \"Netscape\", \"Browser\": \"Chrome\", \"OSVersion\": 9, \"Plataform\": \"Linux armv8l\", \"UserAgent\": \"Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"AppVersion\": \"5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"BrowserVersion\": 63.03239111}"
         },
         "term_id":"a174ac7e-be49-4ab2-8539-83e85367b866"
      }
   ]
}

My debug at line 30:
{data=({email=null, id=e729f678-8793-4793-a50a-2ad85b221139, inserted_at=2019-05-10T18:16:46, mobile_phone=null, person_id=5557e08f-b569-47b9-993c-29fb85830724, session_metadata={ip=xxx, user_agent={"OS": "Android", "ip": "xxx", "Vendor": "Google Inc.", "AppName": "Netscape", "Browser": "Chrome", "OSVersion": 9, "Plataform": "Linux
 Thanks for your help!
Hi,

I'm trying to create a validation rule that is triggered when the lead is converted, as you can see in the image below, but I'm having problems, the rule is: if the conversion button is triggered, it will check if the record owner (as it is highlighted in the image) is a specific type of user profile. But  is returning the error message when she should accept it, and I am not even able to get the debug logs.

Thats my Validation Rule:
AND(
ISCHANGED(IsConverted),
Owner:User.ProfileId <> '00e1U000000w4OK'
)

User-added imageObs. Record Owner = Proprietário do Registro(in Portuguese)
 
Hi guys, I was wondering how to show a custom field in the search field instead of the "Name" field. As you can see in the image below, I use automatic numbering for the "Name" field (changing to text is not an option) and then I wanted to show another field instead.
User-added image


 
Hi!

I'm trying to make an API call to populate some fields on a visual force page, but I'm catching this problem, does anyone have any idea what it could be?

System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY> at line 31.
 
public with sharing class pocAuthorizationManagement {
	
    public String email{get;set;}
    public String id_json{get;set;}
    public String inserted_at{get;set;}
    public String mobile_phone{get;set;}
    public String person_id{get;set;}
    public String term_id{get;set;}
    public String ip{get;set;}
    public String user_agent{get;set;}
    
    
    public pocAuthorizationManagement(ApexPages.StandardController stdController){
      
        Lead lead = (Lead)stdController.getRecord();
        lead = [SELECT Id, CPFTxt__c FROM Lead WHERE Id =: lead.Id];
        
        String leadCPF = lead.CPFTxt__c;
        
        String requestEndPoint = 'my-end-point;
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(requestEndPoint);
        request.setMethod('GET');
        HttpResponse response =  http.send(request);
        
        if(response.getStatusCode() ==  200){
            Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(response.getBody());
            System.debug(results);
            Map<String, Object> dataResults = (Map<String, Object>)(results.get('data'));
            email = String.valueOf(dataResults.get('email'));
            id_json = String.valueOf(dataResults.get('id'));
            inserted_at = String.valueOf(dataResults.get('inserted_at'));
            person_id = String.valueOf(dataResults.get('person_id'));
            mobile_phone = String.valueOf(dataResults.get('mobile_phone'));
            term_id = String.valueOf(dataResults.get('term_id'));
            
            Map<String, Object> sessionResults = (Map<String, Object>)(dataResults.get('session_metadata'));
            ip = String.valueOf(dataResults.get('ip'));
            user_agent = String.valueOf(dataResults.get('user_agent'));
            
        } else {
        	ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Algo de errado não está certo');
            ApexPages.addMessage(msg);
        }
   
    }

}
Exemple of my JSON.
{
   "data":[
      {
         "email":null,
         "id":"e729f678-8793-4793-a50a-2ad85b221139",
         "inserted_at":"2019-05-10T18:16:46",
         "mobile_phone":null,
         "person_id":"5557e08f-b569-47b9-993c-29fb85830724",
         "session_metadata":{
            "ip":"xxx",
            "user_agent":"{\"OS\": \"Android\", \"ip\": \"xxx\", \"Vendor\": \"Google Inc.\", \"AppName\": \"Netscape\", \"Browser\": \"Chrome\", \"OSVersion\": 9, \"Plataform\": \"Linux armv8l\", \"UserAgent\": \"Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"AppVersion\": \"5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"BrowserVersion\": 63.03239111}"
         },
         "term_id":"a174ac7e-be49-4ab2-8539-83e85367b866"
      },
      {
         "email":null,
         "id":"c7cec531-4057-4684-a6b9-6422e5138b9d",
         "inserted_at":"2019-05-10T18:16:46",
         "mobile_phone":null,
         "person_id":"5557e08f-b569-47b9-993c-29fb85830724",
         "session_metadata":{
            "ip":"xxx",
            "user_agent":"{\"OS\": \"Android\", \"ip\": \"xxx\", \"Vendor\": \"Google Inc.\", \"AppName\": \"Netscape\", \"Browser\": \"Chrome\", \"OSVersion\": 9, \"Plataform\": \"Linux armv8l\", \"UserAgent\": \"Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"AppVersion\": \"5.0 (Linux; Android 9; SAMSUNG SM-G9650 Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36\", \"BrowserVersion\": 63.03239111}"
         },
         "term_id":"a174ac7e-be49-4ab2-8539-83e85367b866"
      }
   ]
}

My debug at line 30:
{data=({email=null, id=e729f678-8793-4793-a50a-2ad85b221139, inserted_at=2019-05-10T18:16:46, mobile_phone=null, person_id=5557e08f-b569-47b9-993c-29fb85830724, session_metadata={ip=xxx, user_agent={"OS": "Android", "ip": "xxx", "Vendor": "Google Inc.", "AppName": "Netscape", "Browser": "Chrome", "OSVersion": 9, "Plataform": "Linux
 Thanks for your help!
Hi,

I'm trying to create a validation rule that is triggered when the lead is converted, as you can see in the image below, but I'm having problems, the rule is: if the conversion button is triggered, it will check if the record owner (as it is highlighted in the image) is a specific type of user profile. But  is returning the error message when she should accept it, and I am not even able to get the debug logs.

Thats my Validation Rule:
AND(
ISCHANGED(IsConverted),
Owner:User.ProfileId <> '00e1U000000w4OK'
)

User-added imageObs. Record Owner = Proprietário do Registro(in Portuguese)