• Vigneshwaran Gurunathan
  • NEWBIE
  • 124 Points
  • Member since 2015
  • Senior Software Engineer
  • Kayal Adhi Private Limited


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 1
    Questions
  • 11
    Replies
User-added image
i have these three object as account and client Link__c is a junction object.
now i have to find details of Client__c where i have record account.customerid__c.
query i have written is. 
clientLst=[select Name from Client__c where client__c.id IN:(select Account__r.CustomerId__c from Accounts_Users_Link__r where Account__r.CustomerId__c=:currentSiteCust)];
where " Accounts_Users_Link__r "is child relation ship name
I am getting error unexpected token 'select'
Thanks in advance.
I can't solve the task in this tutorial because I don't have the "Related Contacts" choice and a few others are missing too if I compare what I have with what is shown on the website.
https://developer.salesforce.com/trailhead/en/getting_started_crm_basics/admin_intro_accounts_contacts/admin_intro_accounts_contacts_relationships
Hi ,
i am tryinng to create multiple child records when a parent record is created . The records in child object should be coming from an another relaetd object . Here is my data model

Data model 1: Account (Parent)<<<<<< Invoices (Child)
Date Model 2 : Account (Master Parent)<<<<<<Payment(Parent)<<<<<<Payment Line Items (Child) <<<<<< Invoices 

Example Salesforce is my account and it has 20 Invoices , now i am creating a Payment ( notthing related to invoice at this time ) record and when i save this payment record 20 payment line items should be created. One record for each invoice salesforce account has .

I can create a child to a parent automatically but not sure how to create mutiple child records based on the Invoices object .

Here is the start with able to create single child record 
 
trigger CreatePaymentLineItems on Payment__c (after insert) {   
   
  
   
    
        List<Payment_Item__c> PItem = new List<Payment_Item__c>();
        for (Payment__c Pay : trigger.new) 
        {
           Payment_Item__c PBI = new Payment_Item__c();
            PBI.Payment__c = Pay.Id;
           // PBI.Financial__c = Pay.;
           
            
            PItem.add(PBI);
        }
        insert PItem;
    }

Thanks,
Akhil
  • April 05, 2016
  • Like
  • 1
User-added image

I have created a permission set with the system permission "Two-Factor Authentication for User Interface Logins" and assigned it to the Samantha Cordero users. Here is the login history which i have used the Authenticator to authenticate the login of the user.

User-added image
What else am i missing? Any help is much appreciated.
Hi all,

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

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

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

Thank you,
Wendy
User-added image
i have these three object as account and client Link__c is a junction object.
now i have to find details of Client__c where i have record account.customerid__c.
query i have written is. 
clientLst=[select Name from Client__c where client__c.id IN:(select Account__r.CustomerId__c from Accounts_Users_Link__r where Account__r.CustomerId__c=:currentSiteCust)];
where " Accounts_Users_Link__r "is child relation ship name
I am getting error unexpected token 'select'
Thanks in advance.
What is a recursive trigger? What are the best ways to avoid recursive triggers can somebody explain with a simple example.Please help me to understand the concept of recursive triggers.

Thanks
Hi, 

 I have a requirement to edit opportunitylineitems using visualforce page I wrote below controller and visualforce page but it is not working as expected please suggest what is the issue in the code. I am using apex : action support method but it is not working please suggest


Controller
public with sharing class OptyLineEditCnt{

public ApexPages.StandardController sc;
public Opportunity Opp {get;set;}
public List<OpportunityLineItem> OLIlist2 {get ;set;}
public integer text3{get;set;}
public integer qty{get;set;}
public integer unt{get;set;}

public OptyLineEditCnt(ApexPages.StandardController sc) { 

this.Opp = (Opportunity)sc.getRecord();

OLIlist2 = [Select name,ID, Quantity, OpportunityId,PricebookEntry.name,UnitPrice,listprice,TotalPrice,Discount_rate__c,Reseller_discount_rate__c,ProductCode,
                   Product2Id
            FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id];
}


public List<OpportunityLineItem> getOLIs() {

    List<OpportunityLineItem> OLIlist2 = [Select  name,ID, Quantity, OpportunityId,PricebookEntry.name,UnitPrice,listprice,TotalPrice,Discount_rate__c,Reseller_discount_rate__c,ProductCode,
                                                  Product2Id    
                                          FROM OpportunityLineItem WHERE OpportunityId = '00634000012hmEG' ]; //:Opp.Id

    return OLIlist2;

}

 public void calculate()
 {
  Decimal totalprice;
  
    text3 =  qty * unt;     
         
    } 
    
    
public pageReference calculate1()
{
 //try
 // {
  calculate();
//  }
 // catch (NullPointerException ex) {
 //   System.debug('Exception');
 // }
  return null;
 }
  
    
    
public PageReference saveIt() {
     
    update OLIlist2;

    return null;

}
}
Visual Force
<apex:page standardController="Opportunity" extensions="OptyLineEditCnt">

<apex:form >
  <apex:outputPanel id="test">
<apex:pageBlock title="Opportunity Products">
  <apex:pageBlockTable var="OLI" value="{!OLIs}" id="newProduct"  columnsWidth="50%">
  
         <apex:column headerValue="Quantity">
        <apex:inputText id="Quantity" value="{!OLI.Quantity}"/>
        </apex:column>
        
        <apex:column headerValue="Sale Price">
        <apex:inputText id="Unitprice" value="{!OLI.UnitPrice}"/>
        </apex:column>
        
       
        <apex:column headerValue="Final Price">
        <apex:inputText id="Finalprice" value="{!text3}">
            <apex:actionSupport event="onmouseover" action="{!calculate1}" reRender="test"/>
             <apex:param id="qtyid" name="qtyid" value="{!OLI.Quantity}"
                            assignTo="{!qty}"/>
              <apex:param id="untid" name="untid" value="{!OLI.UnitPrice}"
                            assignTo="{!unt}"/>               
         </apex:inputText>   
        </apex:column>
        
         
        
        
         </apex:pageBlockTable>
         
</apex:pageBlock>
</apex:outputPanel>
</apex:form>

</apex:page>


 
I can't solve the task in this tutorial because I don't have the "Related Contacts" choice and a few others are missing too if I compare what I have with what is shown on the website.
https://developer.salesforce.com/trailhead/en/getting_started_crm_basics/admin_intro_accounts_contacts/admin_intro_accounts_contacts_relationships
Hi,

I have created a visual force page 2 fields class and fee. when ever the class is selected or changed from picklist--the fee field should be refreshed based on the amount value we soql from fees__c object.
used action support with params with on change event of class picklist
Problem: the render is happening on first change of picklist only???
the fee field is not displayed on changing the picklist field???

Here is the code:

VF Page:
<apex:page standardController="Student_Reg__c" extensions="stuExt1">
<apex:form >
<apex:pagemessages ></apex:pagemessages>
<apex:pageblock >
<apex:pageblocksection title="Student Details" >
<apex:inputText value="{!Student_Reg__c.First_Name__c}"/>
<apex:inputField value="{!Student_Reg__c.Last_Name__c}"/>
<apex:inputField value="{!Student_Reg__c.Date_Of_Birth__c}"/>
<apex:inputField value="{!Student_Reg__c.Class__c}">
<apex:actionsupport rerender="fee_info" event="onchange" action="{!changeFee}">
<apex:param name="cid" value="{!Student_Reg__c.Class__c}"/>
</apex:actionsupport>
</apex:inputField>
</apex:pageblocksection>
<apex:pageBlockSection title="Fee Details" id="fee_info">
<apex:inputField value="{!fe.amount__c}"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>


Extension:
public class stuExt1 {

    string classs=ApexPages.currentPage().getParameters().get('cid');
    public fees__c fe {get;set;}
    public stuExt1(ApexPages.StandardController stdController) {

    }
    
    public void changeFee(){
    integer f=integer.valueof(classs);
    system.debug(f);
    fees__c fe=[select branch__c,class__c,Amount__c from fees__c where class__c=:f limit 1];
        
    }

}
list<account> a= new list<account>();
List<Account> acclist = [select id, name,Isdeleted from account  limit 4];
for(account acc:acclist)
{
   a.add(acc); 
}

undelete a;


Above is my code getting error please help me where I was written wrong....
User-added image

I have created a permission set with the system permission "Two-Factor Authentication for User Interface Logins" and assigned it to the Samantha Cordero users. Here is the login history which i have used the Authenticator to authenticate the login of the user.

User-added image
What else am i missing? Any help is much appreciated.
Hi ,
i am tryinng to create multiple child records when a parent record is created . The records in child object should be coming from an another relaetd object . Here is my data model

Data model 1: Account (Parent)<<<<<< Invoices (Child)
Date Model 2 : Account (Master Parent)<<<<<<Payment(Parent)<<<<<<Payment Line Items (Child) <<<<<< Invoices 

Example Salesforce is my account and it has 20 Invoices , now i am creating a Payment ( notthing related to invoice at this time ) record and when i save this payment record 20 payment line items should be created. One record for each invoice salesforce account has .

I can create a child to a parent automatically but not sure how to create mutiple child records based on the Invoices object .

Here is the start with able to create single child record 
 
trigger CreatePaymentLineItems on Payment__c (after insert) {   
   
  
   
    
        List<Payment_Item__c> PItem = new List<Payment_Item__c>();
        for (Payment__c Pay : trigger.new) 
        {
           Payment_Item__c PBI = new Payment_Item__c();
            PBI.Payment__c = Pay.Id;
           // PBI.Financial__c = Pay.;
           
            
            PItem.add(PBI);
        }
        insert PItem;
    }

Thanks,
Akhil
  • April 05, 2016
  • Like
  • 1
Hi,
we use standard controllers when we want to inherit the standard behaviour of those objects ,and custom controllers if we want to use our own logics on a VF page,but i wonder, why we need extensions along with custom controllers,can't we include all the logics within a custom controller itself instead of defining all the logics both in controller and extension.

Both controllers and extensions are apex classes,so what is the difference between them and how to know which of them is a controller or an extension when we look at apex classes,
 
Hi ,
i am tryinng to create multiple child records when a parent record is created . The records in child object should be coming from an another relaetd object . Here is my data model

Data model 1: Account (Parent)<<<<<< Invoices (Child)
Date Model 2 : Account (Master Parent)<<<<<<Payment(Parent)<<<<<<Payment Line Items (Child) <<<<<< Invoices 

Example Salesforce is my account and it has 20 Invoices , now i am creating a Payment ( notthing related to invoice at this time ) record and when i save this payment record 20 payment line items should be created. One record for each invoice salesforce account has .

I can create a child to a parent automatically but not sure how to create mutiple child records based on the Invoices object .

Here is the start with able to create single child record 
 
trigger CreatePaymentLineItems on Payment__c (after insert) {   
   
  
   
    
        List<Payment_Item__c> PItem = new List<Payment_Item__c>();
        for (Payment__c Pay : trigger.new) 
        {
           Payment_Item__c PBI = new Payment_Item__c();
            PBI.Payment__c = Pay.Id;
           // PBI.Financial__c = Pay.;
           
            
            PItem.add(PBI);
        }
        insert PItem;
    }

Thanks,
Akhil
  • April 05, 2016
  • Like
  • 1
I am planning to take the 201, 211 and 401 certifications - does anyone know do the Trailhead modules align to these and if so which modules do you need to do for each certification?

Thanks all
Jim
Hi,
we use standard controllers when we want to inherit the standard behaviour of those objects ,and custom controllers if we want to use our own logics on a VF page,but i wonder, why we need extensions along with custom controllers,can't we include all the logics within a custom controller itself instead of defining all the logics both in controller and extension.

Both controllers and extensions are apex classes,so what is the difference between them and how to know which of them is a controller or an extension when we look at apex classes,