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
Dafina BojaDafina Boja 

Problem with fields in Order

Hello there , 

I have a little problem here in my org , I have a field in order a dropdown list with Booked/Not Yet booked , what I wannt to do is: 
When i click this field Booked it is a picklist I want to change the other field to Today ()

So when i click Booked field i want to change the date to today other field :) 

Cheers
Best Answer chosen by Dafina Boja
Footprints on the MoonFootprints on the Moon
Hi Dafina,
You can write "before update" trigger on "Order" where, if value of Order's dropdown list from Trigger.new is euqal to Booked, then set other field to today.
 
trigger OrderTrigger on Order (before update){

     for(Order updatedOrder : Trigger.new){

          if(updatedOrder.<Dropdown_Value> == 'Booked'){

               updatedOrder.<Other_field> = today();

          }
    }
}

Let me know if this helps.

All Answers

Footprints on the MoonFootprints on the Moon
Hi Dafina,
You can write "before update" trigger on "Order" where, if value of Order's dropdown list from Trigger.new is euqal to Booked, then set other field to today.
 
trigger OrderTrigger on Order (before update){

     for(Order updatedOrder : Trigger.new){

          if(updatedOrder.<Dropdown_Value> == 'Booked'){

               updatedOrder.<Other_field> = today();

          }
    }
}

Let me know if this helps.
This was selected as the best answer
Dafina BojaDafina Boja

User-added image

Look at this picturfe so the first one dropdown list  and then the second one to today is the date i wana show for today

Footprints on the MoonFootprints on the Moon
Remove the angled brackets from both the statements.
Keep it as updatedOrder.Follow_up_Status__c & updatedOrder.Follow_up_Meeting_Booked__c
Dafina BojaDafina Boja

User-added image

 

Hello , idk what's going on now :O 

Footprints on the MoonFootprints on the Moon
Replace TODAY() with Date.Today()
Should be fine!
Dafina BojaDafina Boja
Thank you for everything , that works perfectly :)