• Bryan Revelant 21
  • NEWBIE
  • 5 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hello, 
Is it possible to SOQL Salesforce for a Record Name without knowing the object name?
Hello, 
So I wrote a test class however I am unable to test my subclass? I have researched this issue and I am not sure how still. 

If I try --- SalesCoachSetup.SectionWithItems.getScSection(); i get an sytax error saying that Type is not visible: SalesCoachSetup.SectionWithItems


-- I have a ton of code for the Main Class. 
public with sharing class SalesCoachSetup {

    // subclass for section items to display on the admin page  
    class SectionWithItems {
        private Sales_Coach_Section__c scSection;
        private List<ItemProduct> itemProducts;
        
        public Sales_Coach_Section__c getScSection(){return this.scSection;}
        public List<ItemProduct> getItemProducts(){return this.itemProducts;}
        
        public SectionWithItems(Sales_Coach_Section__c pSection, List<Sales_Coach_Section_Item__c> pScSectionItems) {
            this.scSection = pSection;
            this.itemProducts = new List<ItemProduct>();
            
            for(Sales_Coach_Section_Item__c item : pScSectionItems){
                this.itemProducts.add( new ItemProduct(item));
            }
        }   
    }
}

We have a button for fetching estimate traffic from Similarweb in SFDC - on lead level. According to our admin, I should have suffiecient right, (similar rights to others, for them it works) but somehow I still get an error:

A problem with the OneClick JavaScript for this button or link was encountered:

{Faultcode:’soaping:Client’, fault string:’System.DmlException: Update failed. First exception on row 0 with id 00Q0N00000bDidnUAC; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on abject id: []

Class.SimilarWebApi.fetchObjectsAndUpdateTrafficEstimates: line 70, column 1
Class.SimilarWebApi.updateEstimatedMonthlyTrafficForLeads: line 37, column 1’,} 

We already enabled Apex Class Access:
SimilarWebApi 
SimilarWebApiTest 
SimilarWebRestMock 

Does anyone know what the problem could be?

 

public class SorcodesIntegration 
{
public string bank_sort_code{get;set;}
public string bank_account_number{get;set;}
public string bank{get;set;}
public string address{get;set;}
public string branch{get;set;}
public string city{get;set;}
public string zip{get;set;}
public string country{get;set;}
public string phone{get;set;}
public string DD{get;set;}
public integer code{get;set;}
//public integer Sorcode{get;set;}
public string Modmessage{get;set;}
public string modulus{get;set;}
//public string Sortmessage{get;set;}
//public object sort_found{get;set;}
public string sort_found1{get;set;}
public boolean b=false;

  public SorcodesIntegration(ApexPages.StandardController Controller) 
   {  
     Application_Request__c wesapp=(Application_Request__c)Controller.getRecord(); 
  
    Application_Request__c wesapp=[select Id, bankIdentifier__c,bankAccountNumber__c,Bank_Account_Validity__c from Application_Request__c where Id=:wesapp.id];
    string sortcode=wesapp.bankIdentifier__c;
    String account=wesapp.bankAccountNumber__c;
    String Bank_Account_Validity=wesapp.Bank_Account_Validity__c;
    String api_Key=' ';
    String requestEndPoint='https://api.iban.com/clients/api/v4/sort';
    requestEndPoint+='/?api_key='+api_key;
    requestEndPoint+='&format=json';
    requestEndPoint+='&sortcode='+sortcode;
    requestEndPoint+='&account='+account;
    Http http=new Http();
    Try{
    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());
       Map<String,Object> mainresultbank=(Map<String,Object>)(results.get('bank_data'));   
       Map<String,Object> mainresultpayment=(Map<String,Object>)(results.get('payment_schemes')); 
       Map<String,Object> mainresultresponse1=(Map<String,Object>)(results.get('validations')); 
       Map<String,Object> mainresultresponse2=(Map<String,Object>)(mainresultresponse1.get('modulus'));
       Map<String,Object> mainresultresponse3=(Map<String,Object>)(mainresultresponse1.get('sort_found'));
       string bank=String.valueOf(mainresultbank.get('bank'));
       string address=String.valueOf(mainresultbank.get('address'));
       string branch=String.valueOf(mainresultbank.get('branch'));
       string city=String.valueOf(mainresultbank.get('city'));
       string zip=String.valueOf(mainresultbank.get('zip'));
       string country=String.valueOf(mainresultbank.get('country'));
       string phone=String.valueOf(mainresultbank.get('phone'));
       string DD= string.valueof(mainresultpayment.get('DD'));
       string modulus=string.valueof(mainresultresponse1.get('modulus'));
      //Modmessage= string.valueof(mainresultresponse2.get('message'));
      //Sorcode= integer.valueof(mainresultresponse3.get('code'));
       //sortmessage=string.valueof(mainresultresponse3.get('message'));
       string sort_found1=string.valueof(mainresultresponse1.get('sort_found'));
      
      boolean b=sort_found1.contains('{code=002, message=Sort Code found in bank directory}');
       If(b)
         {
         integer code= integer.valueof(mainresultresponse2.get('code'));
          if(code==001)
            {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.confirm,'Validation Successful: sortcode found & check digit is valid'));
             
            }
            else
            {
               ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.error,'Validation Failed: account number is incorrect'));
              
            }
        }
       else
       {
       ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.error,'Validation Failed: Sort Code not found in bank directory'));
    
       }
  }
 }
Catch (Exception ex)
{
Apexpages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.FATAL, Exception error occur : '+ex.getstacktracestring()));
    }
 }
}

hi,

 I want to add a custom button in Related List.

 for example  I have a custom button named add in contact and i want that button in account  Related List.

  • March 26, 2011
  • Like
  • 0