• Ben Merton
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
I am trying to create a tabbed related list on a custom object.  The related list API name is Quality_Objective__c.  As per this post, I have changed this to Quality_Objective__r.  I have also tried Quality_Objective __c and just Quality_Objective, but it is returning an error on the page saying either:

1.  'Quality_Objective__r' is not a valid child relationship name for entity QMS
2.  'Quality_Objective__c' is not a valid child relationship name for entity QMS
3.  'Quality_Objective' is not a valid child relationship name for entity QMS

Please help!
 
<apex:page standardcontroller="QMS__c">

<apex:tabPanel >
<apex:tab label="QMS" name="QMS" id="QMS">
  <apex:relatedList subject="{!QMS__c}" list="Quality_Objective__r" />
</apex:tab>
</apex:tabPanel>


</apex:page>

 
I am trying to create a simple VisualForce page that bypasses the standard tab on a custom object.  This custom object only has one record, so the History view is unnecessary.  I want anyone clicking on the tab to be directed to that one record (i have the id).

How should I query this page in the Visualforce code, so that any Visualforce changes I also make are made to this record?
I am attempting to use some code from this blog:  https://rakeshistom.wordpress.com/tag/count-records-in-a-related-list/

The first piece of code is giving me a problem on line 4.  It is saying 'expecting right parentheses, found 'c''?  Any ideas?
 
trigger MANUALPROCEDURE on Manual_Procedure_Revisions__c (after insert, after update, after delete, after undelete) 
{
  Map<Id,Manuals_and_Procedures__c> MANUALPROCEDURE = new Map<Id,Manuals_and_Procedures__c>();
  if(Trigger.new <> nullfor (Manual_Procedure_Revisions__c c : Trigger.new)
      if(Manual_Procedure__c<>null)
        MANUALPROCEDURE.put(c.Manual_Procedure__c,new Manuals_and_Procedures__c(id=c.Manuals_and_Procedures__c));
  if(Trigger.old<>nullfor(Manual_Procedure_Revisions__c c : Trigger.old)
      if(c.Manual_Procedure__c<>null)      
        MANUALPROCEDURE.put(c.Manual_Procedure__c,new Manuals_and_Procedures__c(id=c.Manual_Procedure__c));
  update MANUALPROCEDURE.values();
}

 
This is my first attempt at an APEX trigger or any kind of Apex.

I am trying to update a field in a child object from a field in a parent object.  It is giving an error on line 4:  Parent_Object.Parent_Custom_Field__r variable is not found

ie a Parent_Custom_Field__c from Parent_Object__c into the Child_Object__c Child_Custom_Field__c

trigger NEWTRIGGER on Child_Object__c (before insert) {

    For (Child_Object__c ChildField : Trigger.new)
        
    {ChildField.Child_Custom_Field=Parent_Object.Parent_Custom_Field__r;
    }
}
This is my first attempt at an APEX trigger or any kind of Apex.

I am trying to update a field in a child object from a field in a parent object.  It is giving an error on line 4:  Parent_Object.Parent_Custom_Field__r variable is not found

ie a Parent_Custom_Field__c from Parent_Object__c into the Child_Object__c Child_Custom_Field__c

trigger NEWTRIGGER on Child_Object__c (before insert) {

    For (Child_Object__c ChildField : Trigger.new)
        
    {ChildField.Child_Custom_Field=Parent_Object.Parent_Custom_Field__r;
    }
}