• nateie
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies

Hi Apex Community,

 

I'm having some trouble with a trigger and hope someone can help me out.

 

What I want to do...

For new and updated "Customer Feedback" records (Custom Obj), I want to update the corresponding "Issue" records (Custom obj) to aggregate various fields from "Customer Feedback".

 

The challenge?

The "Issue" object is three objects away.

Linkage architecture:  [CUSTOMER FEEDBACK]   <---Master Detail---   [CASE]   <---Junction--->   [ISSUE LINK]   <---Junction--->   [ISSUE]

 

My approach...

Write a trigger to the effect of the following:

 

trigger aggregateCustomerFeedbackOnIssues on Customer_Feedback__c (before insert, before update

{


  /** STEP 1: WORK MY WAY UP FROM Customer Feedback to Issue **/


  // Get list of all new/updated Customer Feedback records

  List<Customer_Feedback__c> feedbackRecords = [SELECT Id, Case__c FROM Customer_Feedback__c WHERE Id IN :Trigger.newMap.keySet()];


  // Build a set of all relevant Case records

  

  // Builds a set of the relevant IssueLink records 

 

  // Build a set of all relevant Issue records

 

 

  /** STEP 2: WORK MY WAY DOWN FROM Issue to Customer Feedback **/

    ...

}

 

The problem?

My attempts thus far have resulted in a number of errors (e.g. System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Customer_Feedback__c.Case__r:) and I'm convinced I'm approaching this incorrectly. If there's anyone out there who can point me in the right direction, I'd be mighty thankful!

 

Thanks in advance all!


  • January 25, 2012
  • Like
  • 0

Hi Apex Community,

 

I'm having some trouble with a trigger and hope someone can help me out.

 

What I want to do...

For new and updated "Customer Feedback" records (Custom Obj), I want to update the corresponding "Issue" records (Custom obj) to aggregate various fields from "Customer Feedback".

 

The challenge?

The "Issue" object is three objects away.

Linkage architecture:  [CUSTOMER FEEDBACK]   <---Master Detail---   [CASE]   <---Junction--->   [ISSUE LINK]   <---Junction--->   [ISSUE]

 

My approach...

Write a trigger to the effect of the following:

 

trigger aggregateCustomerFeedbackOnIssues on Customer_Feedback__c (before insert, before update

{


  /** STEP 1: WORK MY WAY UP FROM Customer Feedback to Issue **/


  // Get list of all new/updated Customer Feedback records

  List<Customer_Feedback__c> feedbackRecords = [SELECT Id, Case__c FROM Customer_Feedback__c WHERE Id IN :Trigger.newMap.keySet()];


  // Build a set of all relevant Case records

  

  // Builds a set of the relevant IssueLink records 

 

  // Build a set of all relevant Issue records

 

 

  /** STEP 2: WORK MY WAY DOWN FROM Issue to Customer Feedback **/

    ...

}

 

The problem?

My attempts thus far have resulted in a number of errors (e.g. System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Customer_Feedback__c.Case__r:) and I'm convinced I'm approaching this incorrectly. If there's anyone out there who can point me in the right direction, I'd be mighty thankful!

 

Thanks in advance all!


  • January 25, 2012
  • Like
  • 0

Hello,

 

Im using the Force.com IDE for writing Apex code. Is there any way to write debug statements to print a value to the console ?. An example would be really appreciated.

 

Thank You

  • April 09, 2010
  • Like
  • 0

Hi,

I have copied text from an exisitng long text area field to a new rich text area field successfully using the following apex method (Encapsulation_NewInstructions__c is a rich text area field):

 

WebService static void UpdateEncapsSteps()

{

List <Solution> solutions = new List<Solution>();

for (Solution mySol : [Select Id, Encapsulation_Instructions__c, Encapsulation_NewInstructions__c From Solution])

{

mySol.Encapsulation_NewInstructions__c = mySol.Encapsulation_Instructions__c;

solutions.add(mySol);

}

update solutions;

}

 

All went well except text have been copied without the break lines (I suppose that in long text area break line is '/r/n' and the new rich text area field doesn't know to convert it into an HTML structure).

 

for example:

 

The origin was:

"straight forward. Need to run the Encapsulator from a short path (For example E:\43a and not C:\documents and settings\user\desktop\encapsulator 1.0.0.43a').
Otherwise, the encapsulation fails." 

 

The result was:

straight forward. Need to run the Encapsulator from a short path (For example E:\43a and not C:\documents and settings\user\desktop\encapsulator 1.0.0.43a'). Otherwise, the encapsulation fails.

 

How can I convert text to HTML format and saving the structure?

Do I have build in method for this?

 

Thanks

Shuky