• RONU
  • NEWBIE
  • 10 Points
  • Member since 2012
  • Salesforce Consultant

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 14
    Replies
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..!!
  • April 13, 2018
  • Like
  • 0
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..!!
  • October 02, 2017
  • Like
  • 0
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..!!
  • September 04, 2017
  • Like
  • 0
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
  • August 25, 2017
  • Like
  • 0
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.
  • August 16, 2017
  • Like
  • 0
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...!!
  • March 03, 2017
  • Like
  • 0
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...!!
  • July 21, 2016
  • Like
  • 1
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...!! (:
  • June 20, 2016
  • Like
  • 0
Hi Experts,

I need a help in VF page development which is developed using xml platform. Below is the description of my task :

- There is a button and when clicked it exports an workbook with many worksheets in it.
- Now I need to HIDE one worksheet on one of the condition. For example, XYZ worksheet should only get open when "Reason for change" field on object is blank otherwise it should get hidden. 

Attaching VF code written only for that particular sheet :

VF Page :-

<Worksheet ss:Name="Budget History">
<Table>
<Column ss:Width="160" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="160" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>

<Row>
<Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="Quote_For_Services"><Data ss:Type="String"><b>Quote for Services</b></Data></Cell>
</Row>
<Row>
<Cell ss:Index="1" ss:StyleID="Arial_Eleven_bold"><Data ss:Type="String"><b>{!proposal.Apttus_Proposal__Account__r.name}</b></Data></Cell>
</Row>
<Row></Row>
<Row> <Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="s4"><Data ss:Type="String"><b>Budget History</b></Data></Cell> </Row>
<Row>
<Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="s4"><Data ss:Type="String"><b>Protocol: {!proposal.APTS_Protocol_No__c}</b></Data></Cell>
</Row>
<Row></Row> <Row></Row>
<Row>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Category</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Updated Study Value</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Previous Study Value*</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Difference</b></Data></Cell> </Row> <apex:repeat value="{!topTableDisplay}" var="line"> <Row> <Cell ss:Index="1" ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.categoryName}</Data></Cell> <Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.currentValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.previousValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.difference}</Data></Cell>
</Row> </apex:repeat>
<Row></Row> <Row></Row>
<Row> <Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Proposal Number</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Proposal Version</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Date</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Reason</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Total Value</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Difference</b></Data></Cell> </Row>
<apex:repeat value="{!bottomTableDisplay}" var="line"> <Row> <Cell ss:Index="1" ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.proposalNumber}</Data></Cell>

<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.proposalVersion}</Data></Cell>
<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.DatePresented}</Data></Cell>
<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.reason}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.TotalValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.difference}</Data></Cell> </Row> </apex:repeat>
</Table>
</Worksheet>

I need to hide this worksheet when "Reason for change" is not blank and show this sheet when "Reason for change" is blank.

I tried many things to resolve it but couldn’t succeed. Now I need your help to get it done asap. Please let me know how can you help me and when can we connect for the same.
  • June 15, 2016
  • Like
  • 0
Hi Experts,

I need a help in SFDC development which is developed using xml platform and I have never worked on this language but this is being used in one of our previous functionality and now I need to amend the same for the client. Below is the description of my task :

- There is a button and when clicked it exports an workbook with many worksheets in it.
- Now I need to HIDE one worksheet on one of the condition. For example, XYZ worksheet should only get open when "Reason for change" field on object is blank otherwise it should get hidden. 

Attaching VF code written only for that particular sheet :

VF Page :-

<Worksheet ss:Name="Budget History">
<Table>
<Column ss:Width="160" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="160" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>
<Column ss:Width="80" ss:StyleId="s_plain"/>

<Row>
<Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="Quote_For_Services"><Data ss:Type="String"><b>Quote for Services</b></Data></Cell>
</Row>
<Row>
<Cell ss:Index="1" ss:StyleID="Arial_Eleven_bold"><Data ss:Type="String"><b>{!proposal.Apttus_Proposal__Account__r.name}</b></Data></Cell>
</Row>
<Row></Row>
<Row> <Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="s4"><Data ss:Type="String"><b>Budget History</b></Data></Cell> </Row>
<Row>
<Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="s4"><Data ss:Type="String"><b>Protocol: {!proposal.APTS_Protocol_No__c}</b></Data></Cell>
</Row>
<Row></Row> <Row></Row>
<Row>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Category</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Updated Study Value</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Previous Study Value*</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Difference</b></Data></Cell> </Row> <apex:repeat value="{!topTableDisplay}" var="line"> <Row> <Cell ss:Index="1" ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.categoryName}</Data></Cell> <Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.currentValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.previousValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.difference}</Data></Cell>
</Row> </apex:repeat>
<Row></Row> <Row></Row>
<Row> <Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Proposal Number</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Proposal Version</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Date</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Reason</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Total Value</b></Data></Cell>
<Cell ss:StyleID="s2_budget_summary"><Data ss:Type="String"><b>Difference</b></Data></Cell> </Row>
<apex:repeat value="{!bottomTableDisplay}" var="line"> <Row> <Cell ss:Index="1" ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.proposalNumber}</Data></Cell>

<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.proposalVersion}</Data></Cell>
<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.DatePresented}</Data></Cell>
<Cell ss:StyleID="s1_left_right_border_history"><Data ss:Type="String">{!line.reason}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.TotalValue}</Data></Cell>
<Cell ss:StyleID="{!currencyNameStyleIdMapHistory[totalsCurrency]}"><Data ss:Type="Number">{!line.difference}</Data></Cell> </Row> </apex:repeat>
</Table>
</Worksheet>

I need to hide this worksheet when "Reason for change" is not blank and show this sheet when "Reason for change" is blank.

I tried many things to resolve it but couldn’t succeed. Now I need your help to get it done asap. Please let me know how can you help me and when can we connect for the same.
  • June 15, 2016
  • Like
  • 0
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. 
  • May 10, 2016
  • Like
  • 0
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.
  • January 13, 2016
  • Like
  • 0

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;
}
}
}
}

  • April 11, 2013
  • Like
  • 0

Hello all,

   below is my question...please help me out in calling vf page after selecting one record from list... :

 

¢Create a VF page and VF component.
¢In the 1st page, get all the Opportunities in a <apex:selectList>.
¢On select of the Opportunity, go to the 2nd page where you can edit/save selected opportunity's StageName, Close Date.

 

 
  • April 05, 2013
  • Like
  • 0

Hi all,

    i have one question to ask...!!!!!!!!!

There is a vf page which contains some records of account and in front of every record there is one picklist field(i created using <apex:selectlist>) which has 3 values red,blue,green...n there is a custom text field "priority" on account object...all i need is whenever i select any value in vf page so the same value should be inserted into the custom text field...and there is a save update button on vf page which do all this process...

 

BRIEF SUMMARY :

- select any value(blue,green,red) on vf page for any record

- after clicking save the same value should be inserted into the account record's custom field "priority"....

 

any help would be appreciated....thanks in advance....

  • March 14, 2013
  • Like
  • 0

 

Hello all,

   I am a beginner in salesforce so i need some help from our professionals...below is my requirement :

 

I have 2 custom objects Employee__c and EmployeeDetails__c....EmployeeDetails__c has a employee__c lookup field....Now i want to make one custom button "MORE" on Employee__c detail page next to new EmployeeDetails__c button....Now after clicking on MORE , a vf page should open which displays the records of EmployeeDetails__c....

VF page contains two buttons i.e +ve and -ve buttons....On clicking +ve it should add the EmployeeDetails__c records and on clicking -ve it should delete EmployeeDetails__c records on that VF page itself....

 

This should be done using wrapper class....So i need to make one wrapper class and one vf page...

Any help would be greately appreciated....thanks in advance....

 

 

  • March 13, 2013
  • Like
  • 0
this is my query...plzzz someone help me out...
 
-Create a picklist on Account object named Color Codes. Add values Red, Green and Blue to it. Create same picklist on Contact also.
 

-Create a trigger, if Red is selected delete the all related contacts, if Green is selected map the same value on related contacts, if Blue is selected clone all contacts to the parent account (Parent Account is a field on Account object) record.

 

thanks in advance...

 

this is what i have made...

 

trigger ColorCodeTrigger on Account (after insert,after update)
{
Set<Id> accIds = new Set<Id>();

for(Account con :trigger.new)
{
accIds.add(con.Id);
}

List<contact> conlist = new List<contact>([select id,AccountId from contact
where id in: accIds]);

for(Account con : trigger.new)
{
if(conlist.size() > 0 && conlist != null && con.color_codes__c == 'Red')
{
conlist.clear();
}

update conlist;
}
}

 

  • March 02, 2013
  • Like
  • 0
this is my query...plzz help me out...
 
¢Create a custom object “Revenue”. Create a field named “Total Revenue”.
¢Create another custom object Revenue Line Items. Create field named “Add Revenue” and lookup to Revenue.
¢Create a trigger on Revenue Line Items to update “Total Revenue” field on Revenue with the total(sum) of “Add Revenue” on all child records to the parent revenue record.
¢Handle insert, update and delete. Also handle change of parent revenue on child record.
 
BRIEF SUMMARY :
suppose “Total Revenue” = 30 and “Add Revenue” = 20...if i add 10 in “Add Revenue” than 
  “Total Revenue” should become 40 automatically and if i subtract 10 from “Add Revenue” than
  “Total Revenue” should become 20....
 
Any help would be appreciated....!!!
  • February 20, 2013
  • Like
  • 0

Hello Experts,

 

I am beginner in SFDC and trying my hand to develop my first Visual Page with Apex Class. Please help me in understanding the code. Scenario: Create a VF page which has a Account lookup and once you select the account by clicking lookup and click submit , it should display the contact list of that particular account. Once the list appears of associated contacts users should have two options with the associated contact i.e.. Edit and Del

 

so far I am able to create below VF code which is showing me the Account with lookup but I am struggling with the rest of the part.Account :

 

 

<apex:page standardController="contact" >
<apex:sectionHeader title="My Page" />
<apex:pageBlock >
<apex:form >
Account : <apex:inputField id="accountLookup" value="{!Contact.AccountId}"/>
<p> <apex:commandButton action="{! save}" value="Submit!"/> </p>
</apex:form>
</apex:pageBlock>
<apex:relatedList list="Contacts" />
</apex:page>

 

any help is appreciated. Regards

  • December 09, 2012
  • Like
  • 0
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...!!
  • July 21, 2016
  • Like
  • 1
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..!!
  • September 04, 2017
  • Like
  • 0
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.
  • August 16, 2017
  • Like
  • 0
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...!! (:
  • June 20, 2016
  • Like
  • 0
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. 
  • May 10, 2016
  • Like
  • 0
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.
  • January 13, 2016
  • Like
  • 0

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;
}
}
}
}

  • April 11, 2013
  • Like
  • 0
this is my query...plzz help me out...
 
¢Create a custom object “Revenue”. Create a field named “Total Revenue”.
¢Create another custom object Revenue Line Items. Create field named “Add Revenue” and lookup to Revenue.
¢Create a trigger on Revenue Line Items to update “Total Revenue” field on Revenue with the total(sum) of “Add Revenue” on all child records to the parent revenue record.
¢Handle insert, update and delete. Also handle change of parent revenue on child record.
 
BRIEF SUMMARY :
suppose “Total Revenue” = 30 and “Add Revenue” = 20...if i add 10 in “Add Revenue” than 
  “Total Revenue” should become 40 automatically and if i subtract 10 from “Add Revenue” than
  “Total Revenue” should become 20....
 
Any help would be appreciated....!!!
  • February 20, 2013
  • Like
  • 0

Hello Experts,

 

I am beginner in SFDC and trying my hand to develop my first Visual Page with Apex Class. Please help me in understanding the code. Scenario: Create a VF page which has a Account lookup and once you select the account by clicking lookup and click submit , it should display the contact list of that particular account. Once the list appears of associated contacts users should have two options with the associated contact i.e.. Edit and Del

 

so far I am able to create below VF code which is showing me the Account with lookup but I am struggling with the rest of the part.Account :

 

 

<apex:page standardController="contact" >
<apex:sectionHeader title="My Page" />
<apex:pageBlock >
<apex:form >
Account : <apex:inputField id="accountLookup" value="{!Contact.AccountId}"/>
<p> <apex:commandButton action="{! save}" value="Submit!"/> </p>
</apex:form>
</apex:pageBlock>
<apex:relatedList list="Contacts" />
</apex:page>

 

any help is appreciated. Regards

  • December 09, 2012
  • Like
  • 0

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?