• Debra Yoffie
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I need some assitance with creating a Trigger that creates a task from a lead record that has text in the Lead Web Comment Field to create a task for the Lead owner, with priority of Normal, Subject of Text "Lead Web Comment", Status of Lead Web Comment.

I have this trigger started but don't know exactly how to have all the fields populated with the above requirements.

Could someone please help?


trigger Lead_After_Insert on Lead (after insert)

{
  list<Task> lNewTasks = new list<Task>();

  for(integer i=0; i<trigger.new.size(); i++)

  {

     lNewTasks.add(MyTask = new Task(

       Subject = 'Lead Web Comment',

       WhoID = trigger.new[i].id

       *Other Task Fields Here*

     );

   }

   insert lNewTasks;

}

Hello,

 

I am unable to add the field "Email Opt Out" (API name "HasOptedOutOfEmail") to our Lead page layout in our Sandbox environment.  The strange thing is, when i click "Edit Layout" and attempt to add "Email Opt Out" to the layout, it appears in the layout editing view as it should along with the rest of the fields, but when I save it, it does not show up in the actual layout.

 

This is causing problems during development because my orginization is using the Partner WSDL, and as such we can only access object fields that are in the page layout for that object.  So "Email Opt Out" does not exist as a valid field in the WSDL, and when I try to create or update a Lead with a value in the "HasOptedOutOfEmail" API field, I get a INVALID_FIELD_FOR_INSERT_UPDATE exception.

 

Any ideas, or anyone run into this before?  I would appreciate any help, except for just saying "well then just use the Enterprise client!" -- this is not feasible in our organization right now because our entire Salesforce library was written to use the Partner API.

 

Thank you!

SB