• Siddharth83Jain
  • 44 Points
  • Member since 2015
  • Sr. Tech Architect
  • OSI Consulting

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 25
For Example:
for(Contact con : [Select Id,Salary__c From Contact Where AccountId = :accId Limit 100]){
            System.debug('Check min'+con.Salary__c);
Here I am getting all the salary from contact, now how to compare those and show minimum of them.
FYI:  I know using AggregateResult is more efficient.
We have two communites dedicated for two seperate purpose and lots of knowledge articles in each of them.
When I type something like "What is adaptive" on our community 1, and see recommended articles. It is showing suggetions from other communities what we have. And each articles are assigned on seperate type and category. And we have limited each category to display based on category assigned to it. Still content search on default Salesforce chatter shows content from other. Any idea how to resolve it.
I have a Visualforce PDF quote that is taking informaiton from a field.  However it is not implementing the breaks or next line formatting.  I basically get a run on sentence which is confusing. (the field is !line.Description__c)  Here is the code that controlls this particular field.

           <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line"> <tr>
            <td colspan="1"> <font face="Arial">{!line.Quantity}</font></td>
           <td colspan="2"> <font face="Arial">{!line.PricebookEntry.ProductCode}</font></td>
           <td colspan="6"> <font face="Arial" align="left" > {!line.Description__c} </font></td>
          <td colspan="1" bgcolor="#fafafa"> </td>
          <td colspan="1" bgcolor="#fafafa"> </td>
          <td colspan="6" bgcolor="#fafafa"> </td>
          <td colspan="1" bgcolor="#fafafa"> </td>
          <td colspan="1" bgcolor="#fafafa"> </td>

I need to find a way to pull a few values from case.description. I'm very new to code, and i have no idea where to start. Here's what i need:
if case.description is:
"VAR1: Juice
 VAR1: Lime
 VAR3: Ginger"
How can i put the values for Vars 1-3 into their respective case fields?

Any help is greatly appreciated. Thanks!
For Example:
for(Contact con : [Select Id,Salary__c From Contact Where AccountId = :accId Limit 100]){
            System.debug('Check min'+con.Salary__c);
Here I am getting all the salary from contact, now how to compare those and show minimum of them.
FYI:  I know using AggregateResult is more efficient.
I am creating a Visualforce page that creates a report with images. There are 2 objects, Grizz_Report__c(Parent) and (Visit_Report__c(child). Based on the Grizz_Report__c object, it should pull all the visit_reports__c associated and any images attached under notes and attachments on those visit_report__c. I have the page setup to pull all the visit_report__c records just fine, but I can't figure out how to pull the images attached from those visit_report__c records and display them on the report. Any help would be appriciated. Thank you!

This is my VF page:
<apex:page standardController="Grizz_Report__c" sidebar="false" showHeader="false" extensions="FieldTechReportClass" renderAs="pdf">
    <apex:form >
            Field Tech Report Name:<apex:outputField value="{!Grizz_Report__c.Name}"/><br/>
            Week Starting Date: <apex:outputField value="{!Grizz_Report__c.Week_Starting_Date__c}"/><br/>
            Week Ending Date: <apex:outputField value="{!Grizz_Report__c.Week_Ending_Date__c}"/><br/>            
            Test Program Related: <apex:outputField value="{!Grizz_Report__c.Test_Program_related__c}"/><br/>
            <table width="100%">
                <apex:repeat value="{!Grizz_Report__c.Visit_Reports__r}" var="vr">  
                    <th>Activity Type:</th>
                    <th>Reason for Activity:</th>
                    <th>Activity Reoprt Name:</th>
                    <th>Activity Detail:</th>
                    <th>Activity Date:</th>
                    <td><apex:outputField value="{!vr.Activity_Type__c}"/></td>
                    <td><apex:outputField value="{!vr.Reason_for_Activity__c}"/></td>
                    <td><apex:outputField value="{!vr.Account__c}"/></td>
                    <td><apex:outputField value="{!vr.Name}"/></td>
                    <td><apex:outputField value="{!vr.Activity_Detail__c}"/></td>
                    <td><apex:outputField value="{!vr.Date__c}"/></td>
                        <td><apex:image url="{!imageURL}" width="100"/></td>
This is my class so far. The image will pull from the GrizzReport object but not from the visit report
public class FieldTechReportClass {
    String recId;
    public String imageURL {get;set;}
    //public List<Visit_Report__c> visitReport {get;set;}
    //public Grizz_Report__c grizzReport {get;set;}
    public FieldTechReportClass(ApexPages.StandardController controller) {
        recId = controller.getId();
        //grizzReport = (grizz_report__c)controller.getRecord();
        //visitReport = [SELECT ID FROM Visit_Report__c WHERE Field_Tech_Report__c =: grizzReport.ID];
    public String getFileId() {
        //for(visit_report__c visit : visitReport){
            List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId];
                if(attachedFiles.size() > 0 ) {
                    imageURL = imageURL+attachedFiles[0].Id;              
                return imageURL;    

How can we export data from particular users using data loader.

Thanks in advance
How to get a report into csv format which is outside of salesforce.

Thanks in advance
Hi All,
Is it possible to create two approval process on same object through trigger?If yes please give me a sample code for refernce


I have developed a functionality in Managed Package which need to access org specific VF page (VF page is mentioned in Custom setting).
When the package code calls the page to generate the a PDF its gives error.
// Managed package code
PDFSetting = PDFCustomSetting__c.getOrgDefaults();
String pagename = PDFSetting.PDF_Page_Name__c.trim();       // VF page name defined in custom setting
PageReference pdfPage = new PageReference('/apex/'+pagename+'?id='+record.id);  

Error: PDF generation failed. Check the page markup is valid 

Please suggest a solution to access the page or anyother workaround to generate PDF from package code.
I have created a VF page where in I am displaying some rows in a Table.
What i am trying to achieve is - there is one row named "Status" in the table.Status can have 3 values - RED , GREEN , GREY.
How can i color the row depending upon the value in the status field.
Below is my VF Page
<apex:page controller="AccountSummaryReportController" action="{!loadKeyAccounts}"  >

             body .bPageBlock .pbBody .grey .pbSubheader{
            body .bPageBlock .pbBody .grey .pbSubheader h3{
      .greenColour {color:green;}
      .redColour {color:red;}
      .greyColour {color:grey;}  
    <apex:sectionHeader title="Account Summary Report as of : {!TODAY()}"  description="This Report Shows Accounts modified in last 31 days"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!renderAsPdf}" value="Save as Pdf"/>
            <apex:repeat value="{!objectMap }" var="ProgNameKey" >
                <apex:pageBlock title="{!ProgNameKey}" id="c">
                    <apex:repeat value="{!objectMap [ProgNameKey]}" var="PlanNameKey" >
                        <apex:outputPanel styleClass="grey" layout="block">
                            <apex:pageBlockSection title="{!PlanNameKey}" columns="1" >
                                <apex:pageBlockTable value="{!objectMap [ProgNameKey][PlanNameKey]}" var="lstGrnRate"  border="1" columnsWidth="20%,10%,70%">
                                    <apex:column value="{!lstGrnRate.Account__r.Name}"/>
                                    <apex:column value="{!lstGrnRate.Status__c }" 
                                      styleClass = "{! If(lstGrnRate.Status__c=='RED' ,'redColour',
                                                      If(lstGrnRate.Status__c=='Green','greenColour', 'greyColour')) }" /> 
                                    <apex:column value="{!lstGrnRate.Account_Summary__c}"/>


I create a custom button for opportunity object when i click on that it generates an attachment and that attachment name will be saved as below format 
Format is Account name:listprice__c:time format

listprice__c is product field under opportunity related list ...
for suppose if i have 2 products under opprtinty related list higher amount of listprice__c in these two products will display in attchement format for example i have 2 products under opportunity in these products 1 st product had 25 list price and 2nd product had 40 the attchemat format will be displayed like below.

Account name:40:timeformat

my code is:
   Attinvoice.Name =oppty.account.name+'_'+system.now().format('MM/dd/yyyy')+'.pdf';

Hi ,

I am getting the error while updating the contact : it is giving an error execution of after update causing exception :converted date in future .can some one advise on this it will be helpful.

Hi all,

The following error is being returned when attempting to load a file via Data Loader:

updateCase: execution of BeforeInsert
caused by: System.LimitException: Apex CPU time limit exceeded
Trigger.updateCase: line 7, column 1

Any ideas what may be causing the error and how to correct?

Thank you,

I've created a button on the Account object that will update a field on the Account's Contact records that causes a trigger to fire. The code itself works fine when there are only a few contact records to be updated, but obviously in large batches it causes a delay and I wasn wondering if anyone had any tips for bulkifiying this type of solution Here's the code: 
global with sharing class UpdateContactsButton{
    public List<Contact> ConList {get;set;}   
    webService static  String updateactcontacts(ID caseId){
        List<Contact> ListToUpdate = new List<Contact>();
        List<Contact> conlist = [SELECt ID, AccountID, Update_For_Workflow__c From Contact WHERE AccountId = :caseId];
     For(Contact c : Conlist){
            c.Update_For_Workflow__c = 'Selling Agreement Update' ;
        If(ListToUpdate.size() > 0){
            update ListToUpdate;
        return null;

Thanks in advance!
How can we "Force Download" a static PDF File stored as a Static Resource/Document in a VF Page? By Force Download, I mean that the File shoulld be downloaded straight away to the user's local machine and not open in a new Tab as a PDF. 
I am trying to register my custom domain in my sandbox. After step2, I should have received an email but I havn't and now can't complete the registration process. Can I delete the domain in pending state or try another or any workaround, please suggest. Status under "my doamin" is "Registration is pending".
"Deliverability -> Access Level -> system email only" has been changed to "All email" now.