• Jensenlee
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Dear all,

 

I have been trying at this while pulling my hair out.

It seems simple enough, but I just cant seem to get it right.

 

I need some apex programming help on the following:

 

Will need a a trigger in custom object "Context__c" where a user insert/update/delete a new record in Context, it will effectively Inactive all older records and Active the most recent record based on Effective Date"

 

Custom object "Context__c" contains field "Status" (option of Active and Inactive) and "Effective Date"

 

Can anyone help?

 

Thanks

Jensen

Dear all,

 

I am very new and sforce apex coding with very little knowledge about programming - but I am very keen to learn!

 

Below is a very simple scenario which I am trying is achieve:

 

My requirements is that everytime a new record is inserted or updated to "Context" custom object, I wish to have the status of all records (new and existing) records in "Context" to change to Inactive

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
trigger ChangeContextStatus on Context__c (after insert, after update) 

{

List <Context__c> oCT = [select Status__c, from Context__c 
WHERE End_Markets__c = 'Singapore Domestic'];

    for (Context__c ct: oCT)
    {
                   ct.Status__c = True;
                
    }
    update oCT;
}

If anyone could help, thanks!

Dear all,

 

I have been trying at this while pulling my hair out.

It seems simple enough, but I just cant seem to get it right.

 

I need some apex programming help on the following:

 

Will need a a trigger in custom object "Context__c" where a user insert/update/delete a new record in Context, it will effectively Inactive all older records and Active the most recent record based on Effective Date"

 

Custom object "Context__c" contains field "Status" (option of Active and Inactive) and "Effective Date"

 

Can anyone help?

 

Thanks

Jensen

Dear all,

 

I am very new and sforce apex coding with very little knowledge about programming - but I am very keen to learn!

 

Below is a very simple scenario which I am trying is achieve:

 

My requirements is that everytime a new record is inserted or updated to "Context" custom object, I wish to have the status of all records (new and existing) records in "Context" to change to Inactive

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
trigger ChangeContextStatus on Context__c (after insert, after update) 

{

List <Context__c> oCT = [select Status__c, from Context__c 
WHERE End_Markets__c = 'Singapore Domestic'];

    for (Context__c ct: oCT)
    {
                   ct.Status__c = True;
                
    }
    update oCT;
}

If anyone could help, thanks!

Hi,

 

I want to create a rollup field in Account Object with Opportunity Amount. Can any one help me on this, Actually i'm new in  trigger.