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
Ankit KhuranaAnkit Khurana 

how to perform insert after and before update in same trigger on CASE object.

Hi... 

Please let me know..how to update a custom field in case object {say enter_text_c} on save click such that if we there is an text 'today' in the field it should be converted to today's date..

cbernalcbernal

if I understand. Try with this

 

Trigger nametrigger on case (after update, before update)

{ list<Case> cu = new list<Case>();

  Boolean b='false';

 For(Case c:trigger.new)

 {

  if(c.nter_text_c=='today')

  {

    c.nter_text_c= System.Today();

    cu.add(c);

    b='true';

  }

 }

if(b=true)

{update cu;}

}

Ankit KhuranaAnkit Khurana
Hi.....It could be either a string like......"..then today is my bday."
cbernalcbernal

Replace by this:

 

if(c.nter_text_c=='today')  =>   if(c.nter_text_c.Contains('today'))

Ankit Khurana24Ankit Khurana24

thanks....