• Lalitha Trail Head
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
I have two objects like A and B.Here A is the parent of B.In B object have filed like Total this is formula field.i want this child formula field value update on parent object total field value.After create child record

I have a custom object "Projects__c" and standard "Opportunities" as a related list to projects via a lookup relationship. 

When a user creates a new Opportunity from the Projects__c object, I would like some values from the Project record to prepopulate in the opportunity when it is created. Is there a way to do this with a lookup relationship and Trigger? I know workflow and PB can only do this on save of the new record which would defeat the purpose, and am trying to avoid a URL hack. 

I don't know code other than the first two lines of the trigger, beyond that I get lost. Any suggestions? 

I have a challenge to close the case , by onclicking the Save&Close button on the edit page of the case record. However when we hit on the Save&Close button it will take us to the next editable bage and aske for the mandatory field to be filled and then we have to save it. the requirement is We need to save and close the record on single click on Save&Close. Please suggest how this can be Acheived.
Product2 p2 = new Product2();
        p2.Name = 'P3';
        p2.isActive = true;
        insert p2;
        
        Pricebook2 meupricebook = new Pricebook2();
        meupricebook.Name = 'Meu Pricebook';
        meupricebook.isActive = true;
        insert meupricebook;
        
        PriceBook2 meupricebookrec = [SELECT Id FROM Product2 WHERE id =: meupricebook.Id];
        Id stdpricebookrecid = Test.getStandatPricebookId();
        
        PriceBookEntry sdtpricebookentry = new PriceBookEntry();
        sdtpricebookentry.Product2Id = p2.Id;
        sdtpricebookentry.Pricebook2Id = stdpricebookrecid;
        sdtpricebookentry.UnitPrice = 2000;
        sdtpricebookentry.isActive = true;
        insert sdtpricebookentry;
        
        PriceBookEntry meupricebookentry = new PriceBookEntry();
        meupricebookentry.Product2Id = p2.Id;
        meupricebookentry.Pricebook2Id = meupricebookrec.Id;
        meupricebookentry.UnitPrice = 5000;
        meupricebookentry.isActive = true;
        insert meupricebookentry;
        
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'OPP TESTE 2';
        opp2.CloseDate = System.Today();
        opp2.StageName = 'Prospecting';
        insert opp2;
        
        OpportunityLineItem meuopplineitem = new OpportunityLineItem();
        meuopplineitem.OpportunityId= opp2.Id;
        meuopplineitem.PricebookEntryId = meupricebookentry.Id;
        meuopplineitem.UnityPrice = 7000;
        meuopplineitem.Quantity = 5;
        insert meuopplineitem;

Can someone help me? 
Hi friends,

Hello everyone,
I am creating an invoice PDF.
I have two custom objects 
1)  Invoice__c
2) Invoice_Product__c

These 2 objects have master detail relationship between them (Invoice_Product__c is child object)
 
Here, i am writing a visualforce page on parent object (Invoice__c) where i need to get the values of my child object (Invoice_Product__c).

I was unable to retrieve child(Invoice_product__c) fields on invoice__c.

Error : Error: Unknown property 'VisualforceArrayList.Quantity__c'

My CODE :

<apex:repeat value="{!Invoice__c}" var="inv" id="theRepeat"> 
                   
                    <tr style="font-size:16px;height:300px;vertical-align:text-top;Font-family:Verdana,Arial;"> 
                        <td style="border-left:1px solid;border-top:none;border-right:none;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.Invoice_Products_r.Quantity__c}"/></td>

I could not take repeat value as {!Invoice.Invoice_Product__c} because evenly i am using invoice fields also.

I have checked with all these things but its not working.

1) invoice__c.Invoice_product__r.  ===========> error : Unknown property 'VisualforceArrayList.Quantity__c'
2) Inv.Invoice_products__r  ===================> Error : Unknown property 'Integer.Invoice_Products__r'
3) created a list in my controller and used its instance (i.Quantity__c)  =======>  Unknown property 'Invoice__cStandardController.i


How do i resolve this.

How can we use invoice_product fields on Invoice.

 Please can anyone help me out of this...!
 
  • May 04, 2016
  • Like
  • 0