• SFDC_2706
  • NEWBIE
  • 40 Points
  • Member since 2012
  • Salesforce Consultant

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 25
    Replies

Hi All
There are multiple solutions for this below task but I want to achieve this using standard features of salesforce like roll up summary, formula fields or flows and not using apex. Please help me to send the step by step instructions to achieve this below requirement:

"For each account, I want to find the average value of the next 3 upcoming opportunities by Close Date. The average value needs to be stored on the record and updated in real time."

Thanks in advance..!!

Hello, I am Getting 'DML not allowed Error'.I am bulk approving my records through list button.I am calling my vf page through button and add logic in my apex controller. below is my apex controller. Thanks for any help in advance.
Apex controller

public class Claim_Approval{ 
    
    public ApexPages.StandardSetController setController;
    public List < Claim__c > selectedListViewRecords {get;set;}
    public set<Id> ids = new set<Id>();
    
    public Claim_Approval(ApexPages.StandardSetController setcontroller) {
     
       this.setcontroller = setcontroller;
       List<Claim__c> selectedListViewRecords =(List<Claim__c>) setcontroller.getSelected();
       Set<Id> ids = new Set<Id>();     
       for(Claim__c rec: selectedListViewRecords){     
              ids.add(rec.id);  
       }    
        List<Approval.ProcessWorkitemRequest> requests = new List<Approval.ProcessWorkitemRequest>();      
        List<ProcessInstanceWorkitem> workItems;             
                     
        workItems = [SELECT Id, ProcessInstanceId FROM ProcessInstanceWorkitem WHERE ProcessInstance.TargetObjectId IN :ids];  
        for(ProcessInstanceWorkitem workItem : workItems){                   
            Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();              
            req.setWorkitemId(workItem.Id);                       
            req.setAction('Approve');                 
            req.setComments('No Comment.');              
            requests.add(req);  
             system.debug('requests'+requests); 
          
       }    
        Approval.ProcessResult[] processResults = Approval.process(requests,false);     
    }
}

Hi All,

I need quick advice on this following item. I need to calculate new formula field which will add 1 month, 3 months, 6 months, 1 year and none from the existing due date field when picklist field is selected as below:

Formula example :
If Picklist value is selected 'Annually' then formula would be (Due_Date__c + 1 Year)

Annually : Due_Date__c + 1 Year
Half-yearly : Due_Date__c + 6 Months
Quarterly : Due_Date__ct + 3 Months
Monthly : Due_Date__c + 1 Month
None : Blank

Looking forward for the quick help and thanks in advance..!!

Hi Experts
I have a following requirement and looking for best easy solution for it:
- There are 4 record types on Accounts (A, B, C, D)
- There are 6 record types on Opportunities (O, P, Q, R, S, T)

Now, when i am trying to convert a lead from the standard page in lightning then i want to see a validation error on that screen for following reasons:

- When account record type A is selected, then page should automatically create an opp of record type P and if any other record type is selected manually on opp then i should see an error on the lead conversion page.

- When account record type B is selected, then page should automatically create an opp to record type Q and if any other record type is selected manually on opp then i should see an error on the lead conversion page.

- When account record type C is selected, then user can only choose from O, R, S opp record type and if any other record type is selected manually on opp then i should see an error on the lead conversion page.

Error Message : Please correct the Account and Opp Record Types.

Let me know experts how this can be done and looking forward to your response soon. Thanks in advance..!!

Hi Experts
I am looking to set a Regex syntax for one of my custom field which looks like this "df976353-c0dd-448e-a989-443a4b889442".
I am using below syntax, but getting error :
!REGEX(Customer_ID__c, "\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b")

Any help on correcting this would be greately appreciated..!!
Thanks
Rohan

Hi Experts,
There is a button on leads home page called "Send list email" where an user can select multiple leads and send emails to all of them using this button. My task is when i click on this button and emails are sent then I want to automatically change the status of leads from Open - Not Contacted to Working - Contacted. 

Any help on this topic would be greatly appreciated. Thanks in advance..!!

User-added image

Hi Experts,
There is a button on leads called "Send list email" where an user can select multiple leads and send emails to all of them using this button. However, when i click on this button and emails are sent then I want to automatically change the status of leads from waiting to in-progress. 

Any help on this topic would be greatly appreciated. Thanks in advance..!!

Hi Experts
I need quick help on one of the trigger i have written. I have a trigger on event object and what it does is updating a subject field with "Cencelled" word in front of the subject when one checkbox is checked.
Subject field : Subject__c
Checkbox : eventcancelled__c
trigger : public static void updateSubjectOnActivity(List<Event> newItems , Map<Id,Event> oldItems) {        for(Event currentEvent : newItems){
            if( (oldItems != null && currentEvent.GAM_MeetingCancelled__c != oldItems.get(currentEvent.Id).GAM_MeetingCancelled__c && currentEvent.GAM_MeetingCancelled__c == true )){
                currentEvent.Subject = 'CANCELLED' + ' - ' + currentEvent.Subject;
            }
            if( (oldItems != null && currentEvent.GAM_MeetingCancelled__c != oldItems.get(currentEvent.Id).GAM_MeetingCancelled__c && currentEvent.GAM_MeetingCancelled__c == false )){
                currentEvent.Subject = currentEvent.Subject ;
            }
        }
    }

This is working fine for me. Now i want to remove the "Cancelled" word from subject when again checkbox is unchecked. Not sure how should i take the first oldest value again in my map. 

Please help and thanks in advance..!!

Thank you

Hi Experts
I need quick help in writing one validation rule on opportunity. Requirement is below:
- New, Pipeline and Forecast Record Type: Lost Reason(custom field) and Other Reason(custom field) should not be editable until the Opportunity is set to 'Closed Lost'.

- Renewals Record Type: Loss Type, Loss Reason and Other Reason should not be editable until the Opportunity is set to 'Closed Lost'.

I want these points to be covered in a single VR. Looking forward to your swift help on this.

Thanks in advance..!!
Hi FSL Experts
I have started a new project on FSL and facing one issue. We have one requirement where we need to optimise the route for the delivery guys so that they can see the optimised route for their journey from starting to end. 
- If there are 5 service appointments with 5 different addresses and once resource open the FSL app they can see all the SA's.(This is working)
- Then there should be a provision to accumulate these addresses and give the best optimised route to the delivery guy so that he starts his journey in a sequence rather than going from a same road again and again. The person should see optimised map of all the addresses and starts his journey according to the results given by optimised routing.

I hope the question is clear to you all and looking forward for the resolution from the experts.

Thanks
Hi Experts
I need a solution on lead sharing rules using apex. I have a field called try_me__c on Lead which is a lookup to user record. So whenever the user update this field and put some user name then the same record should become accessible/visible to the same user as currently OWD is set to private. 
Currently we have 30+ sharing rules working on for every user and but really want to get rid of this and want some apex dynamic sharing solution. I hope the requirement is clear to you all.

Looking forward to your quick and amazing answers.

Thanks
Hi
I want to automatically create a private TAG whenever there is any value inserted in custom field of account. Has anybody done this before.? If yes, please share the solution and how can we do this with code or without code.
Your help would be greatly appreciated.

Thanks
Hi
I want to merge custom object records with all the childs realted to those records. There is one parent object and it has 6 child objects. Now i want to merge the parent records.
Example :
- If one parent has 3 child records(3 different objects) and another parent has 3 child records(3 different objects) and if i merge these two parents then the merged record should have total 6 child records with 1 record in every child.
- If one parent has 3 child records(3 different objects) and another parent has 3 child records(same 3 objects) and if i merge these two parents then the merged record should have total 6 child records with each child has 2 records.

if someone has implemented this functionality then please let me know ASAP as I need to complete this on very urgent basis.

Your help would be greatly apprecaited. Thanks in advance..!!
Hi All
can anyone help me in test class for the below trigger which updates time zone according to country/state selected on account.

trigger UpdateTimeZoneAcc on Account(after Insert, after Update) {

Schema.DescribefieldResult fieldResult1 = Account.Time_Zone__c.getDescribe();
   List<Schema.PicklistEntry> pleAcc = fieldResult1.getPicklistValues();
   Map<String,String> Accmapval = new Map<String,String>();
        
   for(Schema.PicklistEntry Accf : pleAcc)
   {
      Accmapval.put(Accf.getValue(),Accf.getLabel());
       System.debug('+++ffvalacc++'+Accf.getValue());      
   } 
  
   List<Account> Acclst = new List<Account>();
   for(Account Accobj: Trigger.new){
        if(trigger.isInsert){
           System.debug('++contyyy+++'+Accobj.billingcountry);
           if(Accmapval.containsKey(Accobj.billingcountry)){
                 if(Accobj.billingcountry!='United States'){
                 Account Acc = new Account(id=Accobj.id,Time_Zone__c = Accmapval.get(Accobj.billingcountry));
                 System.debug('++contyyy++val+'+Accmapval.get(Accobj.billingcountry));
                 Acclst.add(Acc);
                 }
                 else{
                      Account Acc = new Account(id=Accobj.id,Time_Zone__c = Accmapval.get(Accobj.billingcountry));
                 Acclst.add(Acc);
                 }
              // Accobj.Time_Zone__c = Accmapval.get(Accobj.billingcountry);              
           }
       }
       
       if(trigger.isUpdate && (trigger.oldmap.get(Accobj.ID).billingcountry!=Accobj.billingcountry || trigger.oldmap.get(Accobj.ID).billingstate!=Accobj.billingstate)){
           
           System.debug('++contyyy+++'+Accobj.billingcountry);
           if(Accmapval.containsKey(Accobj.billingcountry)){
                 if(Accobj.billingcountry!='United States'){
                     Account Acc = new Account(id=Accobj.id,Time_Zone__c = Accmapval.get(Accobj.billingcountry));
                     System.debug('++contyyy++val+'+Accmapval.get(Accobj.billingcountry));
                     Acclst.add(Acc);
                 }else{
                     Account Acc = new Account(id=Accobj.id,Time_Zone__c = Accmapval.get(Accobj.billingstate));
                     System.debug('++contyyy++val+'+Accmapval.get(Accobj.billingcountry));
                     Acclst.add(Acc);
                 }
              // Accobj.Time_Zone__c = Accmapval.get(Accobj.billingcountry);
              
           }
       }
       
   } 
   
   if(Acclst.size()>0 && Acclst != null){
       update Acclst;
   }    

}

Thanks in advance..!!
Hi All
I created one VR on a custom object called "projects__c" where user is not allowed to enter more than 100% in 5 different percent fields. This works fine on the standard page but when i created a VF page to override the button the error message doesn't pop in the VF page.

I tried using try and catch statements in controller and apex:messages in VF page but no luck. Please find below my code and help me in this :

Controller: (Not entire controller)
public class ProjectsCustomPageCtrl{
  public Projects__c proj {get;set;}

  public ProjectsCustomPageCtrl(ApexPages.StandardController myController){            
            proj = new Projects__c();
      }
      
  public PageReference SaveRec(){  
        if(proj.Name!=null && proj.Name!=''){                         
            insert proj;                  
        }                 
      return new PageReference('/' +proj.id).setRedirect(true);       
    }   
}

VF Page:
<apex:page standardController="Projects__c" extensions="ProjectsCustomPageCtrl" sidebar="false" tabStyle="Projects__c">
<apex:messages/>
 <apex:sectionHeader title="Project Details"/>
   <apex:form >        
      <apex:pageBlock id="blck"> 
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!SaveRec}"/>
                <apex:commandButton value="Cancel" action="{!DoCancel}" immediate="true"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Project Information" columns="2">
                   <apex:inputField value=" {!proj.name}" required="true"/>
                   <apex:inputField value=" {!proj.Account__c}"/>
                   <apex:inputField value=" {!proj.Job_Number__c}"/>
                   <apex:inputField value=" {!proj.Status__c}">
                      <apex:actionSupport event="onchange" action="{!ChkProb}" rerender="blck"/>
                   </apex:inputField>   
                   <apex:inputField value=" {!proj.Line_Owner__c}"/>
                   <apex:inputField value=" {!proj.Probability__c}"/>
                   <apex:inputField value=" {!proj.Gross_Revenue__c}"/>
                   <apex:inputField value=" {!proj.Project_Type__c}"/>
                   <apex:inputField value=" {!proj.X3rd_Party_Cost__c}"/>
                   <apex:inputField value=" {!proj.Start_Date__c}"/>
                   <apex:outputText ></apex:outputText>
                   <apex:inputField value=" {!proj.Duration_In_months__c}"/>                                      
            </apex:pageBlockSection>
         
            <apex:pageBlockSection title="Work Spread Details" columns="2">                  
                   <apex:inputField value=" {!proj.January__c}"/>
                   <apex:inputField value=" {!proj.February__c}"/>
                   <apex:inputField value=" {!proj.March__c}"/>
                   <apex:inputField value=" {!proj.April__c}"/>
                   <apex:inputField value=" {!proj.May__c}"/>
                   <apex:inputField value=" {!proj.June__c}"/>
                   <apex:inputField value=" {!proj.July__c}"/>
                   <apex:inputField value=" {!proj.August__c}"/>
                   <apex:inputField value=" {!proj.September__c}"/>
                   <apex:inputField value=" {!proj.October__c}"/>
                   <apex:inputField value=" {!proj.November__c}"/>
                   <apex:inputField value=" {!proj.December__c}"/>
            </apex:pageBlockSection>       
     </apex:pageBlock> 
     
  </apex:form> 
</apex:page>

Please help me soon. Thanks in advance..!!
Hi All
I created two VF pages to override the standard lead button NEW and EDIT. Lead has 6 record types where 3 record types works with standard salesforce pages and other 3 record types opens with the custom VF page. 

Now when i try to create new lead or edit existing lead and click on cancel button in lightning UI the screen doesn't go back to the detail page of the record or lead main page but it again and again shows the same edit page after refresh. This issue is for the 3 record types which are working standard salesforce pages and everything is working smooth for other 3 record types which opens with custom VF pages.

I am completely lost what to do and what not to do. I tried many things but no luck yet. Please let me know if i am missing something or do i need to give extra permissions or enable anything in lightning UI because all the record types are working perfectly fine in classic view.
Any help would be greately appreciated, thanks in advance.

Regards
Ronu
Hi Everyone

I am struggling with this requirement where when user inserts country value in Lead then field called "Time zone" should auto populate with the respective time zone of that country.
I tried many things but no success. If anyone has done this in his/her CRM, please do post your favorable answer.
Thanks in advance.
Hello Admin Experts,

Could you please tell me the best possible ways or best practices to Run data quality reports to identify any new sources of data pollution..?

Any help would be greatly appreciated. Thank you in advance...!!
Hello Experts,

I have created excel workbook with help of VF page & XML Spreadsheet Reference. However I am not able to insert the company's logo in the first sheet. Can any one please suggest me how to insert an image in the sheet. Below is the VF code :

<apex:page controller="XYZ_controller" sidebar="false" showHeader="false"  contentType="application/vnd.ms-excel#{!object.Name__c}_Bid_Preview.xls" cache="true" action="{!changeProposalStatus}">
    {!xmlheader}
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:x="urn:schemas-microsoft-com:office:excel"
      xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:html="http://www.w3.org/TR/REC-html40">
         
        <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
            <AllowPNG/>
        </OfficeDocumentSettings>
        
        <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
            <WindowHeight>7845</WindowHeight>
            <WindowWidth>12045</WindowWidth>
            <WindowTopX>630</WindowTopX>
            <WindowTopY>630</WindowTopY>
            <ProtectStructure>False</ProtectStructure>
            <ProtectWindows>False</ProtectWindows>
        </ExcelWorkbook>

<Worksheet ss:Name="Cover">
  <Table>
  <Column ss:Width="70" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="250" ss:StyleId="s_plain"/>

    <Row>
        <Cell  ss:Index="2" ss:StyleID="s9_confidential" ss:MergeAcross="3"><Data ss:Type="String">CONFIDENTIAL</Data></Cell>
    </Row>
    <Row></Row>
      
<I NEED TO INSERT AN IMAGE HERE i.e COMPANY'S LOGO> (For testing, any logo will do)

<Row ss:AutoFitHeight="1">
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
    </Row>
    <Row>
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading_lab" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
    </Row>
    <Row></Row>
    
</Worksheet> 
   </Workbook>  
</apex:page>
    
I request your swift support and help on this. Your efforts would be greatly appreciated. Thanks in advance...!!
Hi,

Few days back i asked one question from the salesforce experts which i really found hard to proceed. However there is no response from any of the expert till date. I am quite surprissed with this...!! (:
Hi FSL Experts
I have started a new project on FSL and facing one issue. We have one requirement where we need to optimise the route for the delivery guys so that they can see the optimised route for their journey from starting to end. 
- If there are 5 service appointments with 5 different addresses and once resource open the FSL app they can see all the SA's.(This is working)
- Then there should be a provision to accumulate these addresses and give the best optimised route to the delivery guy so that he starts his journey in a sequence rather than going from a same road again and again. The person should see optimised map of all the addresses and starts his journey according to the results given by optimised routing.

I hope the question is clear to you all and looking forward for the resolution from the experts.

Thanks
Hello Experts,

I have created excel workbook with help of VF page & XML Spreadsheet Reference. However I am not able to insert the company's logo in the first sheet. Can any one please suggest me how to insert an image in the sheet. Below is the VF code :

<apex:page controller="XYZ_controller" sidebar="false" showHeader="false"  contentType="application/vnd.ms-excel#{!object.Name__c}_Bid_Preview.xls" cache="true" action="{!changeProposalStatus}">
    {!xmlheader}
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:x="urn:schemas-microsoft-com:office:excel"
      xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
      xmlns:html="http://www.w3.org/TR/REC-html40">
         
        <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
            <AllowPNG/>
        </OfficeDocumentSettings>
        
        <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
            <WindowHeight>7845</WindowHeight>
            <WindowWidth>12045</WindowWidth>
            <WindowTopX>630</WindowTopX>
            <WindowTopY>630</WindowTopY>
            <ProtectStructure>False</ProtectStructure>
            <ProtectWindows>False</ProtectWindows>
        </ExcelWorkbook>

<Worksheet ss:Name="Cover">
  <Table>
  <Column ss:Width="70" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="250" ss:StyleId="s_plain"/>

    <Row>
        <Cell  ss:Index="2" ss:StyleID="s9_confidential" ss:MergeAcross="3"><Data ss:Type="String">CONFIDENTIAL</Data></Cell>
    </Row>
    <Row></Row>
      
<I NEED TO INSERT AN IMAGE HERE i.e COMPANY'S LOGO> (For testing, any logo will do)

<Row ss:AutoFitHeight="1">
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
    </Row>
    <Row>
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading_lab" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
    </Row>
    <Row></Row>
    
</Worksheet> 
   </Workbook>  
</apex:page>
    
I request your swift support and help on this. Your efforts would be greatly appreciated. Thanks in advance...!!

Hi All,

I need quick advice on this following item. I need to calculate new formula field which will add 1 month, 3 months, 6 months, 1 year and none from the existing due date field when picklist field is selected as below:

Formula example :
If Picklist value is selected 'Annually' then formula would be (Due_Date__c + 1 Year)

Annually : Due_Date__c + 1 Year
Half-yearly : Due_Date__c + 6 Months
Quarterly : Due_Date__ct + 3 Months
Monthly : Due_Date__c + 1 Month
None : Blank

Looking forward for the quick help and thanks in advance..!!

Hi Experts
I am looking to set a Regex syntax for one of my custom field which looks like this "df976353-c0dd-448e-a989-443a4b889442".
I am using below syntax, but getting error :
!REGEX(Customer_ID__c, "\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b")

Any help on correcting this would be greately appreciated..!!
Thanks
Rohan

Hi Experts,
There is a button on leads home page called "Send list email" where an user can select multiple leads and send emails to all of them using this button. My task is when i click on this button and emails are sent then I want to automatically change the status of leads from Open - Not Contacted to Working - Contacted. 

Any help on this topic would be greatly appreciated. Thanks in advance..!!

User-added image

Hi Experts
I need quick help on one of the trigger i have written. I have a trigger on event object and what it does is updating a subject field with "Cencelled" word in front of the subject when one checkbox is checked.
Subject field : Subject__c
Checkbox : eventcancelled__c
trigger : public static void updateSubjectOnActivity(List<Event> newItems , Map<Id,Event> oldItems) {        for(Event currentEvent : newItems){
            if( (oldItems != null && currentEvent.GAM_MeetingCancelled__c != oldItems.get(currentEvent.Id).GAM_MeetingCancelled__c && currentEvent.GAM_MeetingCancelled__c == true )){
                currentEvent.Subject = 'CANCELLED' + ' - ' + currentEvent.Subject;
            }
            if( (oldItems != null && currentEvent.GAM_MeetingCancelled__c != oldItems.get(currentEvent.Id).GAM_MeetingCancelled__c && currentEvent.GAM_MeetingCancelled__c == false )){
                currentEvent.Subject = currentEvent.Subject ;
            }
        }
    }

This is working fine for me. Now i want to remove the "Cancelled" word from subject when again checkbox is unchecked. Not sure how should i take the first oldest value again in my map. 

Please help and thanks in advance..!!

Thank you

Hi,

Can Someone help me with Lightning Component for Sending Mass Email(List Email).

Scenario: In Custom object , We will select the records in List view , (same like in Contacts and Leads.) and from there we need to send email.

please help.
Hi FSL Experts
I have started a new project on FSL and facing one issue. We have one requirement where we need to optimise the route for the delivery guys so that they can see the optimised route for their journey from starting to end. 
- If there are 5 service appointments with 5 different addresses and once resource open the FSL app they can see all the SA's.(This is working)
- Then there should be a provision to accumulate these addresses and give the best optimised route to the delivery guy so that he starts his journey in a sequence rather than going from a same road again and again. The person should see optimised map of all the addresses and starts his journey according to the results given by optimised routing.

I hope the question is clear to you all and looking forward for the resolution from the experts.

Thanks
I'm studying for the Field Service Lightning cert and wanted to download the FSL Managed Package so I could test drive a few of its features. From my understanding, though, I need to install it in a Sandbox or Production Org. The only orgs I have access to are Developer ones; how can I get access to a trial org which will allow me to install the package?
Hi All
I created one VR on a custom object called "projects__c" where user is not allowed to enter more than 100% in 5 different percent fields. This works fine on the standard page but when i created a VF page to override the button the error message doesn't pop in the VF page.

I tried using try and catch statements in controller and apex:messages in VF page but no luck. Please find below my code and help me in this :

Controller: (Not entire controller)
public class ProjectsCustomPageCtrl{
  public Projects__c proj {get;set;}

  public ProjectsCustomPageCtrl(ApexPages.StandardController myController){            
            proj = new Projects__c();
      }
      
  public PageReference SaveRec(){  
        if(proj.Name!=null && proj.Name!=''){                         
            insert proj;                  
        }                 
      return new PageReference('/' +proj.id).setRedirect(true);       
    }   
}

VF Page:
<apex:page standardController="Projects__c" extensions="ProjectsCustomPageCtrl" sidebar="false" tabStyle="Projects__c">
<apex:messages/>
 <apex:sectionHeader title="Project Details"/>
   <apex:form >        
      <apex:pageBlock id="blck"> 
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!SaveRec}"/>
                <apex:commandButton value="Cancel" action="{!DoCancel}" immediate="true"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Project Information" columns="2">
                   <apex:inputField value=" {!proj.name}" required="true"/>
                   <apex:inputField value=" {!proj.Account__c}"/>
                   <apex:inputField value=" {!proj.Job_Number__c}"/>
                   <apex:inputField value=" {!proj.Status__c}">
                      <apex:actionSupport event="onchange" action="{!ChkProb}" rerender="blck"/>
                   </apex:inputField>   
                   <apex:inputField value=" {!proj.Line_Owner__c}"/>
                   <apex:inputField value=" {!proj.Probability__c}"/>
                   <apex:inputField value=" {!proj.Gross_Revenue__c}"/>
                   <apex:inputField value=" {!proj.Project_Type__c}"/>
                   <apex:inputField value=" {!proj.X3rd_Party_Cost__c}"/>
                   <apex:inputField value=" {!proj.Start_Date__c}"/>
                   <apex:outputText ></apex:outputText>
                   <apex:inputField value=" {!proj.Duration_In_months__c}"/>                                      
            </apex:pageBlockSection>
         
            <apex:pageBlockSection title="Work Spread Details" columns="2">                  
                   <apex:inputField value=" {!proj.January__c}"/>
                   <apex:inputField value=" {!proj.February__c}"/>
                   <apex:inputField value=" {!proj.March__c}"/>
                   <apex:inputField value=" {!proj.April__c}"/>
                   <apex:inputField value=" {!proj.May__c}"/>
                   <apex:inputField value=" {!proj.June__c}"/>
                   <apex:inputField value=" {!proj.July__c}"/>
                   <apex:inputField value=" {!proj.August__c}"/>
                   <apex:inputField value=" {!proj.September__c}"/>
                   <apex:inputField value=" {!proj.October__c}"/>
                   <apex:inputField value=" {!proj.November__c}"/>
                   <apex:inputField value=" {!proj.December__c}"/>
            </apex:pageBlockSection>       
     </apex:pageBlock> 
     
  </apex:form> 
</apex:page>

Please help me soon. Thanks in advance..!!
Hi Everyone

I am struggling with this requirement where when user inserts country value in Lead then field called "Time zone" should auto populate with the respective time zone of that country.
I tried many things but no success. If anyone has done this in his/her CRM, please do post your favorable answer.
Thanks in advance.
Hi,

Few days back i asked one question from the salesforce experts which i really found hard to proceed. However there is no response from any of the expert till date. I am quite surprissed with this...!! (:
Hi All,

I have a VF page which shows all the products and its related prices and other fields as well. But in the VF page, products are coming many times(duplication is not an issue) and i need to group all the products with similar name like we do in the Reports standard functionality. Suppose there are 10 records for the same product "Study", it should only show one study value with other records being grouped.

Below is the VF Page :
<apex:page tabStyle="Apttus_Proposal__Proposal__c"  standardController="Apttus_Proposal__Proposal__c"
                                                   extensions="DiscountReportExtension" sidebar="false">
  
    <apex:form >
     <apex:pageBlock title="Discount Sheet" id="pg1">
       <apex:pageBlockButtons location="Top">          
            <apex:actionFunction name="exportToExcel" action="{!exportToExcel}" rerender="refresh" status="myStatus" onComplete="window.close();"/>
             <input type="button" value="Export To Excel" onclick="exportToExcel();" />
       </apex:pageBlockButtons>
     </apex:pageBlock>
     
    <apex:pageBlock >
    <apex:pageBlockTable value="{!PLIlist}" var="pli">      
        <apex:column headerValue="Client Service Name" value="{!pli.APTPS_Client_Service_Name__c}"/>
        <apex:column headerValue="Product name" value="{!pli.Apttus_Config2__ProductId__c}"/>
        <apex:column headerValue="Option" value="{!pli.Apttus_Config2__OptionId__r.name}"/>        
        <apex:column headerValue="Product code" value="{!pli.Apttus_Config2__ProductId__r.ProductCode}"/>
        <apex:column headerValue="Region" value="{!pli.Apttus_Config2__ChargeType__c}"/>
        <apex:column headerValue="List Price" value="{!pli.Apttus_Config2__ListPrice__c}"/>
        <apex:column headerValue="Unit Net Price" value="{!pli.APTS_Unit_Net_Price__c}"/>
        <apex:column headerValue="Standard Price" value="{!pli.Adj_Amount_From_Price_List_Item__c}"/>
        <apex:column headerValue="Standard Price - List Price" value="{!pli.Diff_b_w_LP_Adj_Amt__c}"/>
        <apex:column headerValue="Standard Price - Unit Net Price" value="{!pli.Diff_b_w_UNP_Adj_Amt__c}"/>
        <apex:column headerValue="(Standard Price - List Price)%" value="{!pli.Diff_b_w_LP_Adj_Amt_in__c}"/>
        <apex:column headerValue="(Standard Price - Unit Net Price)%" value="{!pli.Diff_b_w_UNP_Adj_Amt_in__c}"/>      
     </apex:pageBlockTable> 
     </apex:pageBlock>
    
    </apex:form>    
</apex:page>

Below is the Apex class :
public class DiscountReportExtension {
    public Apttus_Proposal__Proposal__c prop {get;set;}
    public Static Transient List<Apttus_Config2__LineItem__c> PLIlist{get; set;}
    public Id propId;
    
    
    Public DiscountReportExtension(ApexPages.StandardController stdController){               
        this.prop = (Apttus_Proposal__Proposal__c)stdController.getRecord();
        propId = prop.Id;    
               
        PLIlist = new List<Apttus_Config2__LineItem__c>([select id,name,APTPS_Client_Service_Name__c,Apttus_Config2__OptionId__r.name,Apttus_Config2__AttributeValueId__r.APTS_Specimen_Type__c,             Apttus_Config2__ProductId__r.ProductCode,Apttus_Config2__ProductId__r.APTS_Lab_Name__c,Apttus_Config2__ProductId__r.APTS_Methodology__c,Apttus_Config2__ProductId__r.APTS_Analyser_Type__c,
                  Apttus_Config2__AttributeValueId__r.APTS_Transport_Temperature__c,Apttus_Config2__ProductId__r.APTS_Stability_Temperature__c, Apttus_Config2__ProductId__r.APTS_Stability__c,
                  Apttus_Config2__AttributeValueId__r.APTS_Collection_Container__c,Apttus_Config2__ProductId__r.APTS_Optimum_Sample_Volume__c, Apttus_Config2__ProductId__r.APTS_Minimum_Sample_Volume__c,                Apttus_Config2__ProductId__r.APTS_Lab_Code__c,Apttus_Config2__ProductId__r.APTS_Lab_Turnaround_Time__c,APTS_Unit_Net_Price__c,Apttus_Config2__ListPrice__c,Adj_Amount_From_Price_List_Item__c,                Apttus_Config2__ChargeType__c,Diff_b_w_LP_Adj_Amt__c,Diff_b_w_LP_Adj_Amt_in__c,Diff_b_w_UNP_Adj_Amt_in__c,Diff_b_w_UNP_Adj_Amt__c,Apttus_Config2__ProductId__c from 
Apttus_Config2__LineItem__c where Apttus_Config2__ConfigurationId__r.Apttus_Config2__Status__c = 'Finalized' AND Apttus_Config2__Quantity__c != 0 AND Apttus_Config2__Quantity__c != null AND  
Apttus_Config2__LineItem__c.Apttus_Config2__ConfigurationId__r.Apttus_QPConfig__Proposald__c =: propId ORDER BY Apttus_Config2__ProductId__c]);     
        
      }
    
    public PageReference exportToExcel() 
    {
        PageReference pg = new PageReference('/apex/ExportDiscountReport?propId='+propId);
        pg.setRedirect(true);
        return pg;
    }
 }

I tried it using Aggregate query but couldn't succeed. Any help would be greately appreciated. Thanks in advance. 
Hi Experts,
I have one requirement where I am storing attachments in notes and attachments section of any record in Template custom object. After that I also want to have a custom URL type field in some custom object . The value will be a direct link to download the attachment file. Whenever any user clicks the link, the attachment should get dowloaded.
I know we can do with the custom formula field, but struggling to get the exact URL code for it.

How to do that? Any idea. I have access to all the fields in attachment record. How to get the download link from that? Please help.

Hi,

I'm trying to write a trigger that will give me the URL to an attachment on a custom object. 
I made a formula text field on a custom object with this formula:

HYPERLINK('/servlet/servlet.FileDownload?file=' + AttachmentId__c, 'View', '_blank')

But the second step is difficult and I can't seem to get it to work. I want a link of the attachment to display. I want to create a after insert trigger but I can't get it to work.. I hope someone knows a solution for this..

Kind regards

Public class ContactTransactionIdCtrl {

public Boolean selectAllCheckbox {get; set;}
Public string u;
Public Contact con;
Public String stId {get;set;}
Public Boolean flagselect = false;
Public Boolean flag {get;set;}
Public Boolean flagQuan {get;set;}
Public Boolean flagPrUIN {get;set;}
Public List<wrapper> wrapList {get;set;}
Public List<Stock_Transaction__c> stList {get;set;}
Public List<Stock_Transaction_Line_Item__c> stliList {get;set;}
Public Stock_Transaction_Line_Item__c stliObj1 {get;set;}
Public String pageId {get;set;}
Public Blob contentFile{get;set;}
Public string nameFile{get;set;}
Public String validateUIN {get;set;}
Public List<recvUINwrapper> recvUINwrapList{get;set;}
Public Boolean StyleFlag {get;set;}
Public String SelectdMaster {get; set;}
Public String inrMaster {get;set;}
Public Stock_Transaction__c stObj {get;set;}
Public integer wrapsize = 0;
public ContactTransactionIdCtrl() {
// ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info,'Below are the Stock Transactions pending to be Received.Please click on the'+
// 'Stock Transaction link to receive Stock Transaction.'));
flagQuan = true;
flagPrUIN = true;
wrapList = new List<wrapper>();
recvUINwrapList = new List<recvUINwrapper>();
u = Userinfo.getUserId();
List<Contact> lstCon = [Select Id, Name from Contact where User__c = : u];
con = lstCon[0];
stList = [Select Id, Name, Transfer_Status__c,Transferred_To__c,Transfer_Date__c,Transferred_From__c from Stock_Transaction__c where
Transferred_To__c =: con.Id AND Transfer_Status__c =: 'In-Transit'];
pageId = ApexPages.currentpage().getparameters().get('Id');
if(pageId!= null) {
stObj = [Select Name, Transfer_Status__c,Transferred_To__c,Transfer_Date__c,Transferred_From__c from Stock_Transaction__c where Id =: pageId ];
}
stliList = [Select Name, Quantity__c ,Product_UIN__c, Part_Master__c, Transfer_Status__c,Receiving_Date__c, Product_Status__c from Stock_Transaction_Line_Item__c
where Stock_Transaction__c =: pageId AND Transfer_Status__c != 'Received' ORDER BY Transfer_Status__c,Quantity__c ];
if(stliList != null && stliList.size()>0) {
for(Stock_Transaction_Line_Item__c stli : stliList) {
wrapList.add(new wrapper(stli,false));
}
}
}
public List<SelectOption> getMasterOption() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('--None--','--None--'));
options.add(new selectOption('OutMaster', 'Outer Master'));
Options.add(new selectOption('InMaster', 'Inner Master'));
return options;
}

Public pageReference prodOuterUIN() {
List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
recvUINwrapper wrap;
if(SelectdMaster != null && SelectdMaster.equals('OutMaster')) {
if(validateUIN != '' && validateUIN != null) {
List<Stock_Transaction_Line_Item__c> stranliList = [Select Product_UIN__c, Part_Master__c, Transfer_Status__c from Stock_Transaction_Line_Item__c
where Stock_Transaction__c =: pageId AND Product_Master_Type__c = 'Outer Master' AND Product_UIN__c =: validateUIN];
if(stranliList != null && stranliList.size()>0) {
for(Stock_Transaction_Line_Item__c stliobj : stranliList) {
if(stliobj.Transfer_Status__c == 'Received') {
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN Already Received');
}
else {
stliobj.Transfer_Status__c = 'Received';
stliobj.Receiving_Date__c = system.today();
tempList.add(stliobj);
wrap = new recvUINwrapper(validateUIN,'Success :: Product UIN successfully Received');
}
}
if(tempList.size()>0) {
update tempList;
}
}
if(stranliList.size() == 0) {
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN not Found');
}
}
else {
wrap = new recvUINwrapper(validateUIN,'Failed :: Invalid Product UIN');
}
if(recvUINwrapList.size() > 0)
recvUINwrapList.add(0,wrap);
else
recvUINwrapList.add(wrap);
validateUIN = '';
}
return null;
}
Public pageReference prodInnerUIN() {

List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
List<UINMaster__c> uinmastertempList = new List<UINMaster__c>();
recvUINwrapper wrap;
if(SelectdMaster != null && SelectdMaster.equals('InMaster')) {
if(validateUIN != '' && validateUIN != null) {
List<Stock_Transaction_Line_Item__c> stranliList = [Select Product_UIN__c, Part_Master__c, Transfer_Status__c from Stock_Transaction_Line_Item__c
where Stock_Transaction__c =: pageId AND Product_Master_Type__c = 'Inner Master' AND Product_UIN__c =: validateUIN];
List<UINMaster__c> lstUINMaster = [Select Assigned_To_Contact__c, Transfer_Status__c, UIN_External__c from UINMaster__c where
UIN_External__c =: validateUIN];
system.debug('lstUINMaster===='+lstUINMaster);
system.debug('stranliList========='+stranliList);
system.debug('stranliList.size========='+stranliList.size());
if(stranliList != null && stranliList.size()>0) {
for(Stock_Transaction_Line_Item__c stliobj : stranliList) {
for(UINMaster__c obj : lstUINMaster) {
if(stliobj.Transfer_Status__c == 'Received') {
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN Already Received');
}
else {
stliobj.Transfer_Status__c = 'Received';
stliobj.Receiving_Date__c = system.today();
obj.Transfer_Status__c = 'Received';
tempList.add(stliobj);
uinmastertempList.add(obj);
wrap = new recvUINwrapper(validateUIN,'Success :: Product UIN successfully Received');
}
}
}
if(uinmastertempList.size()>0) {
update uinmastertempList;
system.debug('uinmastertempList==='+uinmastertempList);
}
if(tempList.size()>0) {
update tempList;
}
}
if(stranliList.size() == 0) {
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN not Found');
}
}
else {
wrap = new recvUINwrapper(validateUIN,'Failed :: Invalid Product UIN');
}
if(recvUINwrapList.size() > 0)
recvUINwrapList.add(0,wrap);
else
recvUINwrapList.add(wrap);
validateUIN = '';
}
return null;
}

Public pageReference productOuterUIN() {
List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
List<UINMaster__c> tempList1 = new List<UINMaster__c>();
recvUINwrapper wrap;
if(SelectdMaster != null && SelectdMaster.equals('OutMaster')) {
system.debug('if outmaster=======');
if(inrMaster != '' && inrMaster != null || validateUIN != null && validateUIN != '') {
List<Stock_Transaction_Line_Item__c> stranliList = [Select Product_UIN__c, Part_Master__c, Transfer_Status__c from Stock_Transaction_Line_Item__c
where Stock_Transaction__c =: pageId AND Product_Master_Type__c = 'Outer Master'
AND Product_UIN__c =: inrMaster];

List<UINMaster__c> lstUINMaster = [Select Assigned_To_Contact__c, Transfer_Status__c, UIN_External__c from UINMaster__c where
UINOuterMaster__r.UIN_OuterCode__c =: inrMaster AND UIN_External__c =: validateUIN];

system.debug('lstUINMaster========='+lstUINMaster);
system.debug('lstUINMaster.size========='+lstUINMaster.size());
if(stranliList != null && stranliList.size()>0 && lstUINMaster != null && lstUINMaster.size()>0) {
for(Stock_Transaction_Line_Item__c stliobj : stranliList) {
for(UINMaster__c obj : lstUINMaster) {
if(stliobj.Transfer_Status__c == 'Received') {
system.debug('if===========');
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN Already Received');
}
else {
system.debug('else============');
stliobj.Transfer_Status__c = 'Received';
stliobj.Receiving_Date__c = system.today();
obj.Transfer_Status__c = 'Received';
tempList.add(stliobj);
tempList1.add(obj);
wrap = new recvUINwrapper(validateUIN,'Success :: Product UIN successfully Received');
}
}
}
if(tempList.size()>0) {
update tempList;
}
if(tempList1.size()>0) {
update tempList1;
system.debug('tempList1==========='+tempList1);
}
}
if(stranliList.size() == 0 || lstUINMaster.size() == 0) {
system.debug('inif=============');
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN not Found');
}
}
else {
wrap = new recvUINwrapper(validateUIN,'Failed :: Invalid Product UIN');
}
if(recvUINwrapList.size() > 0)
recvUINwrapList.add(0,wrap);
else
recvUINwrapList.add(wrap);
validateUIN = '';
}
if(SelectdMaster != null && SelectdMaster.equals('InMaster')) {
system.debug('if inmaster=======');
if(inrMaster != '' && inrMaster != null || validateUIN != null && validateUIN != '') {
List<Stock_Transaction_Line_Item__c> stranliList = [Select Product_UIN__c, Part_Master__c, Transfer_Status__c from Stock_Transaction_Line_Item__c
where Stock_Transaction__c =: pageId AND Product_Master_Type__c = 'Inner Master'
AND Product_UIN__c =: inrMaster];

List<UINMaster__c> lstUINMaster = [Select Assigned_To_Contact__c, Transfer_Status__c, UIN_External__c from UINMaster__c where
UINOuterMaster__r.UIN_OuterCode__c =: inrMaster AND UIN_External__c =: validateUIN];

system.debug('lstUINMaster========='+lstUINMaster);
system.debug('lstUINMaster.size========='+lstUINMaster.size());
if(stranliList != null && stranliList.size()>0 && lstUINMaster != null && lstUINMaster.size()>0) {
for(Stock_Transaction_Line_Item__c stliobj : stranliList) {
for(UINMaster__c obj : lstUINMaster) {
if(stliobj.Transfer_Status__c == 'Received') {
system.debug('if===========');
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN Already Received');
}
else {
system.debug('else============');
stliobj.Transfer_Status__c = 'Received';
stliobj.Receiving_Date__c = system.today();
obj.Transfer_Status__c = 'Received';
tempList.add(stliobj);
tempList1.add(obj);
wrap = new recvUINwrapper(validateUIN,'Success :: Product UIN successfully Received');
}
}
}
if(tempList.size()>0) {
update tempList;
}
if(tempList1.size()>0) {
update tempList1;
system.debug('tempList1==========='+tempList1);
}
}
if(stranliList.size() == 0 || lstUINMaster.size() == 0) {
system.debug('inif=============');
wrap = new recvUINwrapper(validateUIN,'Failed :: Product UIN not Found');
}
}
else {
wrap = new recvUINwrapper(validateUIN,'Failed :: Invalid Product UIN');
}
if(recvUINwrapList.size() > 0)
recvUINwrapList.add(0,wrap);
else
recvUINwrapList.add(wrap);
validateUIN = '';
}
return null;
}
Public pageReference stockTranLIMethod1() {
Pagereference page = new Pagereference('/apex/ContactwithTranLI?id='+pageId).setRedirect(true);
return page;
}
Public pageReference stockTranLIMethod() {
Pagereference page = new Pagereference('/apex/ContactwithTranLI?id='+stId).setRedirect(true);
system.debug('page======'+page);
return page;
}
Public pageReference backTranMethod() {
Pagereference page = new Pagereference('/apex/ContactWithTransactionId').setRedirect(true);
system.debug('page======'+page);
return page;
}
Public pageReference stockRecvMethod() {
List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
//integer wrapsize = 0;
integer i = 0;
wrapsize = wrapList.size();
system.debug('wrapsize====='+wrapsize);
for(wrapper w : wrapList) {
system.debug('inforloop===========');
if(w.selected == true || selectAllCheckbox == true) {
i++;
}
}
if(wrapsize == i) {
system.debug('in iffff============');
Stock_Transaction__c obj1 = new Stock_Transaction__c(id=pageId);
obj1.Transfer_Status__c = 'Received';
update obj1;
}
for(wrapper w : wrapList) {
if(w.selected == true) {
Stock_Transaction_Line_Item__c obj = new Stock_Transaction_Line_Item__c(id = w.stockTranObj.Id);
obj.Transfer_Status__c = 'Received';
if(w.stockTranObj.Receiving_Date__c == null) {
ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'Please Fill Received Date');
ApexPages.addMessage(errormsg);
return null;
}
else
obj.Receiving_Date__c = w.stockTranObj.Receiving_Date__c ;
//flag = true;
w.selected = true;
tempList.add(obj);
}
}
if(tempList.size() > 0)
update tempList ;

Pagereference page = new Pagereference('/apex/ContactwithTranLI?id='+pageId).setRedirect(true);
return page;
}

public PageReference selectAll(){
for(wrapper w : wrapList) {
if(selectAllCheckbox == true){
w.selected = true;
}else{
w.selected = false;
}
}
return null;
}
Public Pagereference ReadFile() {

List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
if(contentFile == null){
ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'Please select the file to upload');
ApexPages.addMessage(errormsg);
return null;
}
recvUINwrapper wrap;
nameFile = contentFile.toString();
List<String> UINlines = nameFile.split('\n');
List<String> lstUIN = new List<String>();
Map<String, String> UINFound = new Map<String, String>();
if(UINlines.size() > 1000){
ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'Please check upload file and restrict total coupon count to less than 1000');
ApexPages.addMessage(errormsg);
return null;
}
try{
for(Integer i=1;i<UINlines.size();i++){
if(UINlines[i] != null && UINlines[i] != '' ){
system.debug('>>>> UIN ORG['+UINlines[i]+']');
system.debug('>>>> UIN['+UINlines[i].replaceAll(',','').trim()+']');
lstUIN.add(UINlines[i].replaceAll(',','').trim());
}
}
recvUINwrapList = new List<recvUINwrapper>();
for(Stock_Transaction_Line_Item__c stliobj : [Select Name, Quantity__c, Product_UIN__c, Part_Master__c, Transfer_Status__c, Receiving_Date__c,
Product_Status__c from Stock_Transaction_Line_Item__c where Stock_Transaction__c =: pageId
AND Product_UIN__c =: lstUIN]) {
UINFound.put(stliobj.Product_UIN__c , stliobj.Product_UIN__c);
if(stliobj.Transfer_Status__c == 'Received'){
wrap = new recvUINwrapper(stliobj.Product_UIN__c , 'Failed :: Product UIN Already Received Please Recheck');
}
else {
stliobj.Transfer_Status__c = 'Received';
stliobj.Receiving_Date__c = system.today();
tempList.add(stliobj);
wrap = new recvUINwrapper(stliobj.Product_UIN__c,'Success :: Product UIN successfully Received');
}
recvUINwrapList.add(wrap);
}
if(tempList.size()>0) {
update tempList;
}
for(String str : lstUIN) {
if(UINFound.get(str) == null){
wrap = new recvUINwrapper(str,'Failed :: Product UIN not Found');
recvUINwrapList.add(wrap);
}
}
}
catch(Exception e) {
ApexPages.addMessages(e);
}
return null;
}

Public pageReference RegisterProdUIN() {
Pagereference page = new Pagereference('/apex/UINRegistration?id='+pageId).setRedirect(true);
return page;
}
Public PageReference search() {
if(SelectdMaster != null && SelectdMaster.equals('InMaster'))
prodInnerUIN();
if(SelectdMaster != null && SelectdMaster.equals('OutMaster') && inrMaster == null && inrMaster == '')
prodOuterUIN();
if(SelectdMaster != null && SelectdMaster.equals('OutMaster') && inrMaster != null && inrMaster != '')
productOuterUIN();
return null;
}
Public pagereference sentReconcMethod() {
List<Stock_Transaction_Line_Item__c> tempList = new List<Stock_Transaction_Line_Item__c>();
for(wrapper w : wrapList) {
if(selectAllCheckbox == true && w.selected != false) {
Stock_Transaction__c obj = new Stock_Transaction__c(id=pageId);
obj.Transfer_Status__c = 'Received';
update obj;
}
}
for(wrapper w : wrapList) {
if(w.selected == true) {
Stock_Transaction_Line_Item__c obj = new Stock_Transaction_Line_Item__c(id = w.stockTranObj.Id);
obj.Transfer_Status__c = 'Submit for Reconciliation';
if(w.stockTranObj.Receiving_Date__c == null) {
ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'Please Fill Received date');
ApexPages.addMessage(errormsg);
return null;
}
else {
obj.Receiving_Date__c = w.stockTranObj.Receiving_Date__c;
}
flag = true;
w.selected = true;
tempList.add(obj);
}
}
if(tempList.size() > 0)
update tempList ;
Pagereference page = new Pagereference('/apex/ContactwithTranLI?id='+pageId).setRedirect(true);
return page;
}
Public class wrapper {
Public Stock_Transaction_Line_Item__c stockTranObj {get;set;}
Public Boolean selected {get;set;}

Public wrapper(Stock_Transaction_Line_Item__c stli,Boolean s) {
this.stockTranObj = stli;
this.selected = false;
}
}
Public class recvUINwrapper {
Public String UINText {get; set;}
Public String Status {get; set;}
public Boolean SuccessFlag {get;set;}
public String timeStr {get;set;}

public recvUINwrapper(String uTxt, String sts) {
UINText = uTxt;
Status = sts;
this.timeStr = String.valueOF(System.Now().Hour()) + ' : ' +String.valueOF(System.Now().minute()) + ' : '+ String.valueOF(System.Now().second()) ;
if(sts != null && sts != '') {
if(sts.contains('Success'))
this.SuccessFlag = true;
else
this.SuccessFlag = false;
}
}
}
}

hi to all,

 

i have a requirement that to covert data from vf page to excel sheet . I am able to export all record & etc... except image field .
Can any one help on this issue..

 

Here my code :

<apex:page controller="cases_ctrl" contentType="application/msWord" >
<apex:pageBlock title="Cases">
    <apex:pageBlockTable value="{!c}" var="c1">
      <apex:column value="{!c1.CaseNumber}"/>
      <apex:column value="{!c1.Date__c}"/>
     <apex:column><apex:image value="{!c1.Images__c}"/></apex:column>
       </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>

I've got a page full of input fields that I want to print. To do this, I'm mirroring the page, making modifications so it looks printable, and then using renderas="pdf." I want to have a button on the input page that links directly to the pdf version with the ID of the input record, so that all the fields are filled in on the PDF version for that input record. I've tried to do the following, which links to the pdf page, but doesnt display the information from the record.

 

 

<apex:commandButton style="font-size:14px" action="{!URLFOR($Page.DocPrintPage, MyObject__c.Id)}" value="Print" />

 

Any ideas?