• Ashutosh Rajput 5
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
My Code for all object is mentioned below. Please suggest me, if i want this for a particular object.

MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();

List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();    
MetadataService.ListMetadataQuery queryCustomField = new MetadataService.ListMetadataQuery();
queryCustomField.type_x = 'CustomField';
queries.add(queryCustomField);    
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 25);
 
// Debug results
for(MetadataService.FileProperties fileProperty : fileProperties) {
  System.debug(fileProperty.fullName + ': createdby=' + fileProperty.createdByName + ', createddate=' + fileProperty.createdDate + ', manageableState=' + fileProperty.manageableState);
 }
 
Hello All please pay attention to this  I have a autocomplete vf page  in which the  one text box is there search account name. i want that whenever the user enter  the name  then the name should come along with his phone number.. right now  only number is coming /Below is the  VF  code and controller code
Vf page:- 
<apex:page controller="AutoCompleteController" >
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js" />
    <apex:styleSheet value="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css" />
    
    <style>
        .displayNone { 
            display:none; 
        }
        .displayBlock {
            display:block;
        }
        .ui-autocomplete-loading { 
            background: white url(/img/loading32.gif) right center no-repeat;
            background-size:15px 15px; 
        }
        .placeHolder {
            font-style: italic;
        }
    </style>
    
    <apex:form id="autoCompleteForm" >
        
        <apex:pageBlock id="searchBlock" >
            <apex:pageBlockSection id="searchSection" title="Search Your Account" columns="1" >
                 <apex:outputLabel value="Account Name" for="AccountBox" />
                 <apex:outputPanel >
                     <apex:inputText id="AccountTextBox" value="{!searchTerm}" styleClass="placeHolder"/>
                     <apex:inputHidden id="searchAccountId" value="{!selectedAccount}" />
                 </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageBlock>
        
    </apex:form>
    
    <script type="text/javascript">
        var PLACEHOLDER = 'Enter Account Name Here'; 
        var AccountObjects;
        var queryTerm;
        $('[id$=AccountTextBox]').autocomplete({
            minLength: 2,
            source: function(request, response) {
                        queryTerm = request.term;
                        AutoCompleteController.searchAccount(request.term, function(result, event){
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 AccountObjects = result;
                                 response(AccountObjects );
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=AccountTextBox]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=AccountTextBox]').val( ui.item.Name );
                        $('[id$=AccountTextBox]').val( ui.item.Phone);
                        $('[id$=searchAccountId]').val( ui.item.Id );
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
             var entry = "<a>" + item.Phone;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=AccountTextBox]').val(PLACEHOLDER);
        $('[id$=AccountTextBox]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=AccountTextBox]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });
    </script>
</apex:page>
Controller:-
public with sharing class AutoCompleteController {
    
    // Instance fields
    public String searchTerm {get; set;}
    public String selectedAccount {get; set;}
    
    // Constructor
    public AutoCompleteController() {
        
    }
    
    // JS Remoting action called when searching for a account name
    @RemoteAction
    public static List<Account> searchAccount(String searchTerm) {
        System.debug('Account Name is: '+searchTerm );
        List<Account> Account= Database.query('Select Id, Name, Phone from Account where name like \'%' + String.escapeSingleQuotes(searchTerm) + '%\'');
        return Account;
    }
    
}
  • March 17, 2015
  • Like
  • 0
Using the new(ish) analytics:reportChart we can very easily display a report's chart in a visualforce page. When attempting to render as PDF in the <apex:page> tag, or getcontentaspdf(), the report charts are not included. 

The report is dynamic, filtered by the ACCOUNT_ID, so I cannot use the ol' grab the image URL from a dashboard:
<analytics:reportChart developerName="Sample_Developer_Name" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!acc.Id}'}]"/>

I am hesitant about using the old Google Image Charts integration, though it's functional, because it's deprecated and there are rumors of taking it offline. I've checked and cannot find an alternate service for image charts. The image charts build an image from URL parameters alone, and return a png, no javascript involved, which seems to be what trips up the pdf converter in APEX. 

Has anyone found a solution for getting analytics:reportchart or on-the-fly graphs/charts included in APEX?

Thanks!