• ReneRend
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 10
    Replies

I am trying to create a trigger that would add a new value to a related list if a value is adeded to a field.

The field is called Reason of Contact (ROC) and when ever a new reason of contact is added or the field is populated it brings the new value to the related list in the Case. This is working correctly but when ever the first reason of contact is added to the case this value is entered twice. But after that everything works fine. So can someone see what is wrong with the code so that it would not create a duplicate value if the list for Reason Of Contacts (ROCs) is empty.

//


trigger createROCchildonCaseUpdate on Case (after update) {

// Create an empty list of String
List<Reasons_of_Contact__c> ROCs = new List<Reasons_of_Contact__c>();

    //For each case processed by the trigger, add a new  

    //ROC record for the specified case.  

    //Note that Trigger.New is a list of all the new positions  

    //that are being created.  

    for (Case newCase : Trigger.new) {
    Case oldCase = Trigger.oldMap.get(newCase.Id);
    if (oldCase.Request_3__c != newCase.Request_3__c | oldCase.Request_3__c != NULL) {

         //Create the new ROC in the related list with the following values
               ROCs.add(new Reasons_of_Contact__c(
                        ProgramCaseLink__c = newCase.Id,
                        Type__c = newCase.Request_3__c,
                        ProgramCommentLookup__c = newCase.Program__c));
        }
    }
    insert ROCs;
}

Hi I am trying to create a simple VF page that displays a report.

 

I have created the report and I can get it on the page.

 

What I am trying to do next is that the user could update the report by selecting a value from inputfield (that is a lookupfield and is currently working) and then the report would update by using the value received from the inputfield by clicking the button Update Report.

 

Here is the current code:

 

<apex:page standardController="Case" showHeader="false" sidebar="false">
<apex:form >
<apex:inputField value="{!Case.Program__c}" id="programname">
</apex:inputfield>
<apex:commandButton value="Update Report" >
</apex:commandbutton>
<apex:iframe src="/00OG0000004HGdT?isdtp=mn&pv1=programname"/>
</apex:form>
</apex:page>

 

If using this way I get the following text on the report

"Program contains programname"

 

So it is not using the value in ID=programname but it is using the word programname to limit the search.

I am trying to create a trigger that would add a new value to a related list if a value is adeded to a field.

The field is called Reason of Contact (ROC) and when ever a new reason of contact is added or the field is populated it brings the new value to the related list in the Case. This is working correctly but when ever the first reason of contact is added to the case this value is entered twice. But after that everything works fine. So can someone see what is wrong with the code so that it would not create a duplicate value if the list for Reason Of Contacts (ROCs) is empty.

//


trigger createROCchildonCaseUpdate on Case (after update) {

// Create an empty list of String
List<Reasons_of_Contact__c> ROCs = new List<Reasons_of_Contact__c>();

    //For each case processed by the trigger, add a new  

    //ROC record for the specified case.  

    //Note that Trigger.New is a list of all the new positions  

    //that are being created.  

    for (Case newCase : Trigger.new) {
    Case oldCase = Trigger.oldMap.get(newCase.Id);
    if (oldCase.Request_3__c != newCase.Request_3__c | oldCase.Request_3__c != NULL) {

         //Create the new ROC in the related list with the following values
               ROCs.add(new Reasons_of_Contact__c(
                        ProgramCaseLink__c = newCase.Id,
                        Type__c = newCase.Request_3__c,
                        ProgramCommentLookup__c = newCase.Program__c));
        }
    }
    insert ROCs;
}

Hi I am trying to create a simple VF page that displays a report.

 

I have created the report and I can get it on the page.

 

What I am trying to do next is that the user could update the report by selecting a value from inputfield (that is a lookupfield and is currently working) and then the report would update by using the value received from the inputfield by clicking the button Update Report.

 

Here is the current code:

 

<apex:page standardController="Case" showHeader="false" sidebar="false">
<apex:form >
<apex:inputField value="{!Case.Program__c}" id="programname">
</apex:inputfield>
<apex:commandButton value="Update Report" >
</apex:commandbutton>
<apex:iframe src="/00OG0000004HGdT?isdtp=mn&pv1=programname"/>
</apex:form>
</apex:page>

 

If using this way I get the following text on the report

"Program contains programname"

 

So it is not using the value in ID=programname but it is using the word programname to limit the search.

How can I create a Formula field that grabs a value from another object?

In this case I have two custom objects: "Sales Order" and "Sales Order Item" 

In the formula editor my only choices are the Object that I am working in (Sales Order) and other objects like:

$System

$User

etc.

 

If this makes sense...I want to create fields in the "Sales Order Object" that derive their value from the "Sales Order Item" object.

---------------------------------------------------------------------

:smileymad:

This is actually part of a bigger problem that I am trying to solve with Email Templates that won't allow me to get Merge fields from more than one object in the same template.

i.e. I create an email template that uses my Sales Order object...  the interface lets me select and insert merge fields from other objects both Standard and Custom... but those merge fields don't actually show up when I see the email

 

Any thought on either would be greatly appreciated