function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj 

Creating workflow rule involving two objects

Hi ,
 
I am trying to create a workflow rule where when i change the status of a task , the status field of the custom object (which i have created ) should automatically change . But I cannot do a field update for the custom object as the Object name is hardcoded (Task) .Any pointers to this ????.
Jeff TalbotJeff Talbot
When Winter '08 released, I also thought that workflow similar to your example would be possible. Unfortunately it's not possible. A Workflow Rule is triggered by a create/edit of a record in a specified object, and although fields in the parent object can now be evaluated for that trigger, Field Updates are still limited to the object specified in the Workflow Rule.
Vijay RautVijay Raut

Hi,

You may create Apex Trigger (After update trigger on Task) here. Once Task status is updated, after update trigger will fire.

Then in that trigger you can update status in custom object as you mentioned.

Hope this will help you.

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

Hi ,

Thanks a lot . I am very new to salesforce, java and apex .This is the code I wrote for the trigger , where LLL is the new custom object created by me.

but the compilation error does not recognize the custom object.

The error i get is Compile Error: Invalid type: LLL at line 8 column 4

Here is the code :

trigger TaskCompleted on Task (after update )
{

if (Trigger.new.Status.equals('Completed') )
 
   {
    sObject s = new LLL();
   LLL  f = (LLL)s;
   f.status = 'Completed' ;

   }

}

 

Ron HessRon Hess
Custom object names always have a trailing sufix == "__c"

So, your code should read something like this:

  LLL_c f =  new LLL__c();