• lainchbury
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies

Hi

 

I'm writing a trigger which fires on an object (Occupancy__c), which is a child of another object (Tenant__c).

 

When the trigger fires, I want to be able to make a list of the parent objects (Tenant__c) in the trigger.

 

I can't work out the syntax to retrieve the list of Tenant__c objects. Here is my code...

 

trigger OnThisTenancyReferencing on TLM__Occupancy__c (after insert, after update) {

for(TLM__Occupancy__c OnTenancy :Trigger.new){
	
	List <TLM__Tenant__c> Tenant = [Select Name from TLM__Tenant__c WHERE TLM__Tenant__c.Id IN :Trigger.new];
	
	
}

}

 

Any help would be much appreciated.

 

Thanks,

 

Paul

 

 

Hi guys

 

I have some workflow that runs when an object (Reference__c) is updated. This obviously works fine when a user updates the object.

 

If an Apex Trigger is run on a related object (Tenant__c) and that trigger updates the Reference__c object, will the workflow on Reference__c fire?

 

Thanks for your help,

 

Paul

Hi

 

I'm trying to create a trigger that fires when a formula field is updated.

 

My question is whether a formula field updating automatically (without the user entering the record and editing or saving) constitutes an UPDATE event that could fire a trigger?

 

Thanks,

 

Paul

Hello

 

I'm trying to use an apex trigger to update the value of a picklist field on a related object. The trigger will execute when a custom object is inserted and then retrive a list of all the Tasks associated with the custom object.

 

I then want to change the 'Status' field (which is a picklist field) on the tasks.

 

Does anyone have any sample code for changing picklist field values in Apex?

 

Thank you.

Hi

 

I'm writing a trigger which fires on an object (Occupancy__c), which is a child of another object (Tenant__c).

 

When the trigger fires, I want to be able to make a list of the parent objects (Tenant__c) in the trigger.

 

I can't work out the syntax to retrieve the list of Tenant__c objects. Here is my code...

 

trigger OnThisTenancyReferencing on TLM__Occupancy__c (after insert, after update) {

for(TLM__Occupancy__c OnTenancy :Trigger.new){
	
	List <TLM__Tenant__c> Tenant = [Select Name from TLM__Tenant__c WHERE TLM__Tenant__c.Id IN :Trigger.new];
	
	
}

}

 

Any help would be much appreciated.

 

Thanks,

 

Paul

 

 

Hi

 

I'm trying to create a trigger that fires when a formula field is updated.

 

My question is whether a formula field updating automatically (without the user entering the record and editing or saving) constitutes an UPDATE event that could fire a trigger?

 

Thanks,

 

Paul

Hello

 

I'm trying to use an apex trigger to update the value of a picklist field on a related object. The trigger will execute when a custom object is inserted and then retrive a list of all the Tasks associated with the custom object.

 

I then want to change the 'Status' field (which is a picklist field) on the tasks.

 

Does anyone have any sample code for changing picklist field values in Apex?

 

Thank you.