• atla satheeshkumar
  • NEWBIE
  • 25 Points
  • Member since 2015
  • Infosys

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 20
    Replies
i am receiving one scenario, My VF page  i am displying one Browse file option .i am uplode one csv file,by using this csv file we can load bulk data into single object.for Example Vf page it's act like dataloader.how to do this scenario.any one suggestion me .forward link
Hi ,

I am populatring custom picklist field(List<SelectOption>) based on another Custom picklist field(List<SelectOption>)  selected value in wrapper class.but it is populating another all column picklist fields because i am rerendering column in pageblock table so all columns populating based on selected value.
I have to refresh only 1 row.  please suggest me the propsed solution.

Please suggest me.
Hi all,

I am receiving the following XML response. Can someone help me to parse this response and get the value of "Assigned_Organization" inside the xml.

I dont know how to get the value of ns0: elements in below XML. 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns0:Query_ServiceResponse xmlns:ns0="urn:ABC_XYX_RE_Interface_Modify_WS">
         <ns0:Assigned_Group>SFDC-SALESFORCE-CRM</ns0:Assigned_Group>
         <ns0:Assigned_Shift_Name />
         <ns0:Assigned_Support>My SOFT</ns0:Assigned_Support_Company>
         <ns0:Assigned_Organization>ITSM</ns0:Assigned_Support_Organization>
      </ns0:Query_ServiceResponse>
   </soapenv:Body>
</soapenv:Envelope>

Thanks in advance
Hi Developers,

Can anyone help me on this issue, I have a Child object that has a Lookup to Parent. I wrote the below apex class and the trigger on child, such that the count of Child records should be shown on each Parent record. I have a number field on the Parent which should be update as per the Trigger.

It works fine except in one scenario, it does not consider the existing Child records on the Parent, hence it shows incorrect count on the Parent record. It works perfect if I add the new Child records. I heard that Batch Apex can resolve this issue, I am not sure how Batch Apex is related here to resolve the isssue. Can I get some guidance here to proceed further.


Any help on this is much appreciated.
Thank you.

Apex Class:

public class ChildCountHelper{
    
    //List<Parent__c> parentList = [select id, child_count__c, (select id from child__r) from Parent__c where id in :parentIDSet];
    
    public List<ID> conList= new List<ID>();
    
    public static void handleBeforeInsert(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        
        for(Child__c childRec: childList){
     
            parentIDSet.add(childRec.Parent__c);
            
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c ++;
        }
        update parentMap.values();
    }
    
    public static void handleBeforeUpdate(List<Child__c> newChildList, List<Child__c> oldChildList){
        Set<ID> parentIDSet = new Set<ID>();
        Map<ID, ID> oldChildMap = new Map<ID, ID>();
        
        for(Child__c childRec: newChildList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        for(Child__c childRec: oldChildList){
            parentIDSet.add(childRec.Parent__c);
            oldChildMap.put(childRec.Id, childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: newChildList)
       {
        /*if(ChildRec.Parent__c!=null){  */
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
           // }
            if(childRec.Parent__c != oldChildMap.get(childRec.id)){
                if(oldChildMap.get(childRec.id) == null && childRec.Parent__c != null){
                    parentMap.get(childRec.Parent__c).child_count__c ++;
                }else if(oldChildMap.get(childRec.id) != null && childRec.Parent__c == null){
                    parentMap.get(oldChildMap.get(childRec.id)).child_count__c --;
                }else if(oldChildMap.get(childRec.id) != null && childRec.Parent__c != null){
                    parentMap.get(oldChildMap.get(childRec.id)).child_count__c --;
                    parentMap.get(childRec.Parent__c).child_count__c ++;
                }
            }
            
        }
        update parentMap.values();
    }
    
    public static void handleBeforeDelete(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        for(Child__c childRec: childList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c --;
        }
        update parentMap.values();
    }
    
    public static void handleBeforeUnDelete(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        for(Child__c childRec: childList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c ++;
        }
        update parentMap.values();
    }

}




Trigger:


trigger ChildTrigger on Child__c (before insert, after update, after delete, after undelete) {
    if (Trigger.isInsert) {
        ChildCountHelper.handleBeforeInsert((List<Child__c>)Trigger.NEW);
    }else if (Trigger.isUpdate) {
        ChildCountHelper.handleBeforeUpdate((List<Child__c>)Trigger.NEW, (List<Child__c>)Trigger.OLD);
    }else if (Trigger.isDelete) {
        ChildCountHelper.handleBeforeDelete((List<Child__c>)Trigger.OLD);
    }else if (Trigger.isUndelete) {
        ChildCountHelper.handleBeforeUnDelete((List<Child__c>)Trigger.NEW);
    }
}  
HI All,

I have a requirement that when i upload a excel sheet in salesforce via visualforce page. I need to display the uploaded excel sheet columns in an page block table as rows. Could you please help me how can i achieve this?

Thank You!!
HI All:  i have one scenario
Oppoerunity is closed/won then we need to create one child Record for Opportunity.we are captruring Closed/won date.
when closed/won date (28/8/2015) then user within 10days(8/9/2015) user unable to create child record send email to salesmanagaer.
In mail we need send minimum oppoerutnity details to salesmanager
How can i do it ?help me out
  • August 28, 2015
  • Like
  • 0
Hi,

I have a list of all open opportunities and the possibility to edit the list. Also I have the depending field recordtype (product) connected with stagename. If I change the recordtype the picklist of stages should update. But if I change the recordtype the stagenames updates not very well.

Thanks,
Sascha
 
<apex:page controller="depen001class">

<apex:form>
<apex:outputpanel id="oppOppList">
<apex:pageblock title="Opportunities" id="pbOpp" mode="inlineEdit">
    <apex:pageBlockButtons location="top">
    </apex:pageBlockButtons>
    <apex:outputtext style="font-size:12pt; font-weight: bold" value="open Opportunities"/>
    <apex:pageblocktable value="{!OppList2}" title="open Opportunities" var="Opp">
        <apex:column headervalue="LINK"> <apex:outputLink target="_blank" value="/{!Opp.Id}">Details</apex:outputLink> </apex:column>
        <apex:column headervalue="Name"> <apex:inputfield value="{!Opp.Name}" required="true"/> </apex:column>    
        
        <apex:column headervalue="Product">
            <apex:selectList value="{!SelectedRType}" size="1" multiselect="false" style="width:150px">
                <apex:actionSupport event="onchange" action="{!getStageList}" reRender="StageRefresh"/>
                <apex:selectOptions value="{!RTypeList}" />             
            </apex:selectList>   
        </apex:column>             
        
        <apex:column headervalue="Amount"> <apex:inputfield value="{!Opp.Amount}" required="true"/> </apex:column>
        
        <apex:column headervalue="Stage" id="StageRefresh">
            <apex:selectList size="1" multiselect="false" style="width:150px">
                <apex:selectOptions value="{!StageOptionList}" />             
            </apex:selectList>      
        </apex:column>                         
        
        <apex:column headervalue="Close Date"> <apex:inputfield value="{!Opp.CloseDate}" required="true"/> </apex:column>              
    </apex:pageblocktable>
</apex:pageblock>    
</apex:outputpanel>
</apex:form>

</apex:page>

Public class depen001class {

Public String SelectedRType {get; set;}
Public List <SelectOption> StageOptionList { get; set; }
Public List <Opportunity> OppList1 {get; set;}

Public depen001class () {
    getOppList2();
}

Public List <Opportunity> getOppList2() {
    OppList1 =  [SELECT Id, Name, RecordTypeId, RecordType.Name, Amount, CloseDate FROM Opportunity WHERE AccountId = '001g000000dzT5rAAE' AND IsClosed = false ORDER BY CloseDate DESC];
    RETURN OppList1;    
}

Public pageReference getOppList() {
    getOppList2();     
    RETURN NULL; 
}    

Public List <SelectOption> getRTypeList() {
    List <RecordType > RTypes = [SELECT Id, Name FROM RecordType WHERE sObjectType = 'Opportunity'];
    List <SelectOption> RTypeOptionList = new List <SelectOption>();
    FOR (RecordType R : RTypes) {
        RTypeOptionList.add (new SelectOption(R.Name, R.Name));
    }
    RETURN RTypeOptionList; 
}

Public void getStageList() {
    StageOptionList = new List <SelectOption>();   
        
        IF(SelectedRType == 'EUW') {
            StageOptionList.add (new SelectOption('0', 'PO'));
            StageOptionList.add (new SelectOption('30', 'TE'));
            StageOptionList.add (new SelectOption('50', 'KU'));
            StageOptionList.add (new SelectOption('75', 'AU'));
            StageOptionList.add (new SelectOption('90', 'UM'));
            StageOptionList.add (new SelectOption('100', 'GW'));
            StageOptionList.add (new SelectOption('0', 'GV'));                                                                        
        }
        IF(SelectedRType == 'BU') {
            StageOptionList.add (new SelectOption('0', 'PO'));
            StageOptionList.add (new SelectOption('10', 'TE'));
            StageOptionList.add (new SelectOption('30', 'AU'));
            StageOptionList.add (new SelectOption('70', 'UM'));
            StageOptionList.add (new SelectOption('100', 'GW'));
            StageOptionList.add (new SelectOption('0', 'GV'));  
        }
}


}

 
 
 Hi Experts,
 
 while saving the record in the child that ie triio sub application its throwing in an error ,
 
 "Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger tRIIO_Update_Project_from_SubApplication caused an unexpected exception, contact your administrator: tRIIO_Update_Project_from_SubApplication: execution of AfterInsert caused by: System.SObjectException: Invalid field PrjApplInvoiceSubDateMap for AggregateResult: Trigger.tRIIO_Update_Project_from_SubApplication: line 47, column 1".

Could anyone help me please
 
 trigger tRIIO_Update_Project_from_SubApplication on tRIIO_Sub_Application__c (after insert,after update,after delete) {

List<AggregateResult> ProjectAppNameResult=new List<AggregateResult>();
Map<String,Date> PrjApplAssRejDateMap=new Map<String,Date>() ;
Map<String,Date> PrjApplInvoiceSubDateMap=new Map<String,Date>() ;
List<String> applicationNameLst=new List<String>();
List<tRIIO_Application__c> applicationLst=new List<tRIIO_Application__c>();
Map<String,tRIIO_Application__c> applicationMap=new Map<String,tRIIO_Application__c>();
List<triio_project__c> PrjLst=new List<triio_project__c>();
set<Id> projectIds = new set<Id>();
List<tRIIO_Sub_Application__c> subAppRecrds=new List<tRIIO_Sub_Application__c>();

 for(tRIIO_Sub_Application__c subapp : (trigger.isdelete?trigger.old:trigger.new))
    {
     if(subapp.Project_Name__c!=null)
     {
            projectIds.add(subapp.Project_Name__c);
            subAppRecrds.add(subapp);
      }
    }
 
 
ProjectAppNameResult = [SELECT  Project_Name__c,
                        Max(h_Dt_Assessed_Rejected__c) MaxAppDateAssedRejected,
                        Max(h_Application_Invoice_SubDate__c) MaxAppInvoiceSubDate FROM tRIIO_Sub_Application__c
                        where Project_Name__c !=null group by Project_Name__c ];        
System.debug('@@ProjectAppNameResult -'+ProjectAppNameResult);
 
for(AggregateResult prjAppName: ProjectAppNameResult)
{
    PrjApplAssRejDateMap.put((String)prjAppName.get('Project_Name__c'),(Date)prjAppName.get('MaxAppDateAssedRejected'));
    PrjApplInvoiceSubDateMap.put((String)prjAppName.get('Project_Name__c'),(Date)prjAppName.get('PrjApplInvoiceSubDateMap'));
}
 
system.debug('@@PrjApplAssRejDateMap-'+PrjApplAssRejDateMap);
system.debug('@@PrjApplInvoiceSubDateMap-'+PrjApplInvoiceSubDateMap);
 
for(Id itrPrj: projectIds)
{
system.debug('@@itrPrj-'+itrPrj);
if(PrjApplAssRejDateMap.containskey('itrPrj') && PrjApplInvoiceSubDateMap.containskey('itrPrj'))
PrjLst.add(new tRIIO_Project__c(id=itrPrj,
                                 Invoice_Submitted_Date__c=PrjApplAssRejDateMap.get(itrPrj),
                                 Assessed_Approved_Date__c=PrjApplInvoiceSubDateMap.get(itrPrj)
                                ));
else if(PrjApplAssRejDateMap.containskey('itrPrj') && !PrjApplInvoiceSubDateMap.containskey('itrPrj'))
PrjLst.add(new tRIIO_Project__c(id=itrPrj,
                                 Invoice_Submitted_Date__c=PrjApplAssRejDateMap.get(itrPrj),
                                 Assessed_Approved_Date__c=null
                                ));
    
 else if(!PrjApplAssRejDateMap.containskey('itrPrj') && PrjApplInvoiceSubDateMap.containskey('itrPrj'))
PrjLst.add(new tRIIO_Project__c(id=itrPrj,
                                 Invoice_Submitted_Date__c=null,
                                 Assessed_Approved_Date__c=PrjApplInvoiceSubDateMap.get(itrPrj)
                                ));  
    
                            
}
 
if(!PrjLst.isEmpty())
  Update PrjLst;
 
 
  }
i am receiving one scenario, My VF page  i am displying one Browse file option .i am uplode one csv file,by using this csv file we can load bulk data into single object.for Example Vf page it's act like dataloader.how to do this scenario.any one suggestion me .forward link
Hi All

I am facing problem saving record from two pageblock table in a single vf page

error
------------

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Related Bank Acc]: [Related Bank Acc]
Error is in expression '{!save_close}' in component <apex:commandButton> in page newbankbook: Class.addrowCon.save_close: line 22, column 1
Class.addrowCon.save_close: line 22, column 1

 
public class addrowCon
{ 
  public integer num { get; set; }
  public List<BankBook__c > accts {get; set;}
  public List<BankBook__c > accts1 {get; set;} 
  public addrowCon()
  {
     accts = new List<BankBook__c >(); 
     accts.add(new BankBook__c ()); 
     accts1 = new List<BankBook__c >(); 
     accts1.add(new BankBook__c ());    
  }
   public PageReference add_rows() {
    for(integer i=0;i<num ;i++)
        {
          accts.add(new BankBook__c ());    
        }
        
        return null;
     }
  public PageReference save_close()
  {       insert accts;
          insert accts1;
     PageReference home = new PageReference('/home/home.jsp');
     home.setRedirect(true);
     return home;
  }
}
 
<apex:page controller="addrowCon" >
<apex:form >
<apex:sectionHeader title="flexandsalesforceblog" subtitle="AddRows" help="Http://flexandsalesforce.blogspot.com"/>
   <apex:pageBlock title="Add row Dynamically" >
     <apex:pageBlockButtons location="bottom">
         <apex:commandButton value="Save" action="{!save_close}" rerender="error"/>
       </apex:pageBlockButtons>
       <Div align="right">
             <apex:inputText value="{!num}" style="width:45px"/>
             <apex:commandButton value="Add rows" action="{!add_rows}"/> 
       </Div>
       <br/>
       <apex:pageBlockTable value="{!accts1}" var="a1" id="table1">
          
          <apex:column headerValue="Date" style="background:gray;"  >
    <apex:inputField value="{!a1.Txn_Date__c}"/>
</apex:column>
 <apex:column headerValue="Payment Type" style="background:gray;">
    <apex:inputField value="{!a1.Credit_Debit__c}"/>
</apex:column>
 <apex:column headerValue="Company Account" style="background:gray;">
    <apex:inputField value="{!a1.Related_Bank_Acc__c}"/>
</apex:column>
      
       </apex:pageBlockTable>
       
       
      <apex:pageBlockTable value="{!accts}" var="a" id="table">
         <apex:column headerValue="Master Code" style="background:gray;">
            <apex:inputField value="{!a.Entries_Code__c}"/>
         </apex:column>
         <apex:column headerValue="Amount" style="background:gray;">
            <apex:inputField value="{!a.Amount__c}"/>
         </apex:column>
        
         <apex:column headerValue="Narration" style="background:gray;">
            <apex:inputField value="{!a.Narration__c}"/>
         </apex:column>
       </apex:pageBlockTable>
   </apex:pageBlock>
    </apex:form>
</apex:page>

 
Can we call future method from finish method of Batch Apex?
I'm looking into adding pagination capabilities to a couple of our visualforce pages and was wonder which is the preferred methods for accomplishing pagination. I've seen ApexPages.StandardSetController used as well as a method using SOQL offset. Which is best or good / bad of each? Thanks.

Hi

can anyone pelase let me know below questions.

 

1. What is the use Javascript Remoting ?

 

2. If more flexible, When we need to use ?

 

3. What is the use of Actionfunction ?

 

4. What is the diffrenece between Actionfunction and Javascript remoting ?

 

5. JS remoting used for mainly calling the APEX method from javascript ? if yes what s the benefits ? can u please let me know real time scanerio ?

 

As of now, I know the js remoting the will be used for calling APEX method from javascript . i just want to know when we need to perform this ?

 

 

Thanks

Vinoth