hi I am beginer with Sales Force . Please dont judge me strictly . I am trying to create trigger for customer object .

Initial data: custom object with field: status type pickup list "maintanace finished", "open", "in progress".

test organisation . One of the task of this organozation has theme "Revision" and all tasks are related to custom object "transport".

The idea of trigger is following : I need to switch trigger when one of the fields status of transport ( transport is my custom object) will be changed for "maintainace finished". trigger should change status of All tasks of the test organization with the theme "Revision" for "completed". My problem that I cant find api for all these elements of Organizations ( tasks, task's status).

trigger Status_completed on Transport__c (after update) 

  for (Transport__c  u : Trigger.new)


    if ( u.Status_c  = 'Maintainace finished')

"here I dont know where to find my api for tasks in orgonisation entityty  and it is fiels like theme  "

where to find api for organization entity tab and it s fields like theme ?

  • 1
    As this is currently written, it's really difficult to understand what you're asking Mar 29, 2016 at 15:43
  • now should be better .
    – Jack
    Mar 29, 2016 at 15:54
  • Hi @Jack, We can help you out but you need to explain the relationship among the objects. Also it will be good if youmention API names of the objects and fields. As a suggestion, I will say you should start exploring trailhead modules where you will get the basic understanding of the code.
    – C0DEPirate
    Mar 29, 2016 at 16:17

1 Answer 1


According to your description I think the trigger should look like this, some of the syntax might be wrong. I wasn't sure about your lookup field from Transport__c to Tasks and the Theme field on Tasks as you didn't provide the API name;

   trigger Status_completed on Transport__c (before update) {

      Set<id> taskids = new Set<Id>();

      for (Transport__c  u : Trigger.new) {

        if ( u.Status__c  = 'Maintainace finished')

 List<Task> taskstoupdate = new List<Task>([Select id,Theme__c from Task where id in: taskids]);

  for(Task t : taskstoupdate){


   update taskstoupdate;

  • Ok thanks very much . Are you sure about taskstoupdate? Because I admire how you have done it . dint have clue before .
    – Jack
    Mar 29, 2016 at 16:26
  • well you'd want to update the tasks status, right? If so you have to create a list of tasks that you want to update using the taskids from the lookupfield. Then you loop through your list modify the 'Theme' of your task and update the whole list Mar 29, 2016 at 16:32
  • that s right . But I have question. Error: No such column 'Theme__c' on entity 'Task'.
    – Jack
    Mar 29, 2016 at 17:57
  • Where I can see that api
    – Jack
    Mar 29, 2016 at 17:58
  • you can go on setup -> task then view all the related fields Mar 29, 2016 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .