• Palash Rana 8
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I want to display List of Aggregated result i.e Id,Name, Count,but cant get it as i get Null Id iall the retrived records
@RestResource(urlMapping='/GetDuplicateReord/*')
global class duplicateRecords {
    
    @HttpGet
    global static List<AccountInfo> getRecords(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        List<AggregateResult> account=[SELECT Name,Prospect_Code__c , Count(id) ids  FROM Account where Id Not In (Select AccountId from Contact)
                         And Id Not In (Select AccountId from Opportunity) GROUP BY Name, Prospect_Code__c  HAVING count(Id)>1];

        List<AccountInfo> r_accounts = new List<AccountInfo>();                

        for(AggregateResult acc:account){
        AccountInfo racc_info = new AccountInfo();
		racc_info.Id=acc.Id;
        //racc_info.Name=acc.Name;
        //racc_info.prospectCode=acc.prospectCode;  
            
        r_accounts.add(racc_info);    
        }
        return r_accounts;
    }
    
    global class AccountInfo{
        String Id;
	    String Name;
      //  String prospectCode;
      
    }
}

Workbench records that i get using GET method
I want to display List of Aggregated result i.e Id,Name, Count,but cant get it as i get Null Id iall the retrived records
@RestResource(urlMapping='/GetDuplicateReord/*')
global class duplicateRecords {
    
    @HttpGet
    global static List<AccountInfo> getRecords(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        List<AggregateResult> account=[SELECT Name,Prospect_Code__c , Count(id) ids  FROM Account where Id Not In (Select AccountId from Contact)
                         And Id Not In (Select AccountId from Opportunity) GROUP BY Name, Prospect_Code__c  HAVING count(Id)>1];

        List<AccountInfo> r_accounts = new List<AccountInfo>();                

        for(AggregateResult acc:account){
        AccountInfo racc_info = new AccountInfo();
		racc_info.Id=acc.Id;
        //racc_info.Name=acc.Name;
        //racc_info.prospectCode=acc.prospectCode;  
            
        r_accounts.add(racc_info);    
        }
        return r_accounts;
    }
    
    global class AccountInfo{
        String Id;
	    String Name;
      //  String prospectCode;
      
    }
}

Workbench records that i get using GET method
Hello,

I am trying to add a logo to the top of a Visualforce PDF. I was originally able to do this using 

 <center><apex:image url="{!$Resource.PM_Invoice}" width="300" height="150"/></center>

However I now need the logo to show based on the logo on the Customer Account - as we use this PDF to generate orders for 2 clients.

I have created a custom URL field on the Account (Logo_URL__c) and a second field Logo Image with the formula below:
IF(LEN(Logo_URL__c)=0,"", IMAGE(Logo_URL__c,"Company Logo"))

This shows the logo on the accounts.

I have then referenced both these fields in my Apex Class Controller.

I am now struggling to get the logo to show on the invoice - I have tried using many variations of the below

<center><apex:image url="{!accountDetails.Logo_URL__c}" width="300" height="150"/></center>

and each time just have a greyed out box where the logo should show.

Does anyone have any ideas?

Thanks,

Kelsey

User-added image
 
I was solving this challenge and my VF code is:

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock>
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="https://ap1.salesforce.com/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>

I am getting the list of accounts as required and on clicking on any of the accouts, it redirects to that accounts detail page.
Still I am getting following error from trailhead:

"The page does not bind to the record ID value (in order to link to the record detail page)"