• bstanger
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

I have an sObject "CLCA_Sub_Category__c" that I don't seem to be able to insert into.  Below is the trigger I'm using.  There are no records in "CLCA_Sub_Category__c" so the first SOQL query does evaluate to isEmpty().

 

Anyone have any thoughts?

 

 

 

trigger GetCTQCategory on Case (before insert, before update) {

    Case[] cs = trigger.new;   
   
    //Add Case.CLCA_Sub_Category Id & Value to CLCA Sub Category Object, if not already there
   
    CLCA_Sub_Category__c[] clcaSub = [Select Name, CaseSubCategoryId__c FROM CLCA_Sub_Category__c
                                    where CaseSubCategoryId__c = :cs[0].Sub_Category__c];

    if (clcaSub.isEmpty()==true)
    {
        CLCA_Sub_Category__c clcaSubNew = new CLCA_Sub_Category__c (Name='Test',
                                            CaseSubCategoryId__c=cs[0].Sub_Category__c);
        insert clcaSubNew;
       
    }
   
}

I have a trigger that mass updates some custom fields on OpportunityLineitems.

 

I have a trigger on OpportunityLineitems that updates the same custom fields when an OpportunityLineitem is updated.

 

The first trigger causes the 2nd trigger to run.

 

How do I stop the 2nd trigger from running temporarily?

 

Any help would be appreciated.

I'm new to SF & writing my first triggers/unit tests.  I'm using Eclipse & the syntax of my trigger is verified, but when I run the test class, I get

 

"System.Exception: Assertion Failed: Expected: 1234, Actual: null"

 

even though I specifically set it in the trigger (oli[0].Teacher_Var_Cost_Per_Hr__c = 1234;) 

 

Any help would be appreciated. 

 

trigger GetCurrentTeacherHrCosts on OpportunityLineItem (before insert, before update) {

 

OpportunityLineItem[] oli = Trigger.new;

 

oli[0].Teacher_Var_Cost_Per_Hr__c = 1234;

 

}

 

public class Test {

static testMethod void myTest(){

OpportunityLineItem oli = new OpportunityLineItem(OpportunityId='0068000000RJ4L8AAL', UnitPrice=9999.99, Quantity=99, PricebookEntryId='01u80000003LaQXAA0');

insert oli;

System.assertEquals(1234, oli.Teacher_Var_Cost_Per_Hr__c);

}}

I have an sObject "CLCA_Sub_Category__c" that I don't seem to be able to insert into.  Below is the trigger I'm using.  There are no records in "CLCA_Sub_Category__c" so the first SOQL query does evaluate to isEmpty().

 

Anyone have any thoughts?

 

 

 

trigger GetCTQCategory on Case (before insert, before update) {

    Case[] cs = trigger.new;   
   
    //Add Case.CLCA_Sub_Category Id & Value to CLCA Sub Category Object, if not already there
   
    CLCA_Sub_Category__c[] clcaSub = [Select Name, CaseSubCategoryId__c FROM CLCA_Sub_Category__c
                                    where CaseSubCategoryId__c = :cs[0].Sub_Category__c];

    if (clcaSub.isEmpty()==true)
    {
        CLCA_Sub_Category__c clcaSubNew = new CLCA_Sub_Category__c (Name='Test',
                                            CaseSubCategoryId__c=cs[0].Sub_Category__c);
        insert clcaSubNew;
       
    }
   
}

Hi:

 Is there a way to find out the day off from a given date?

I have a Date Field called X, If X were to equal 10/01/09 which was Thursday. So like I would like for it to tell me what day is it?

 

I need to write some conditions in my class and I do not know how to get the day from the date.

 

Thanks

MMA

I have a trigger that mass updates some custom fields on OpportunityLineitems.

 

I have a trigger on OpportunityLineitems that updates the same custom fields when an OpportunityLineitem is updated.

 

The first trigger causes the 2nd trigger to run.

 

How do I stop the 2nd trigger from running temporarily?

 

Any help would be appreciated.

I'm new to SF & writing my first triggers/unit tests.  I'm using Eclipse & the syntax of my trigger is verified, but when I run the test class, I get

 

"System.Exception: Assertion Failed: Expected: 1234, Actual: null"

 

even though I specifically set it in the trigger (oli[0].Teacher_Var_Cost_Per_Hr__c = 1234;) 

 

Any help would be appreciated. 

 

trigger GetCurrentTeacherHrCosts on OpportunityLineItem (before insert, before update) {

 

OpportunityLineItem[] oli = Trigger.new;

 

oli[0].Teacher_Var_Cost_Per_Hr__c = 1234;

 

}

 

public class Test {

static testMethod void myTest(){

OpportunityLineItem oli = new OpportunityLineItem(OpportunityId='0068000000RJ4L8AAL', UnitPrice=9999.99, Quantity=99, PricebookEntryId='01u80000003LaQXAA0');

insert oli;

System.assertEquals(1234, oli.Teacher_Var_Cost_Per_Hr__c);

}}