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
salesforce1#salesforce1# 

How to update a text field based on Date field?

Hi

 

How to update a text field based on Date field?

 

Best Answer chosen by Admin (Salesforce Developers) 
IspitaIspita
Hi Balakrishna,
In case you are asking about what will trigger the Workflow/ trigger this is how it is:-
In workflow you will check if the field in question has changes say the field is "DueDate" - there is a function ISCHANGED(fieldname) use that in your workflow rule.
Then defire a field update where change the value of the Text field.
2. Conversely in a trigger you will check the value in:-
if(trigger.new [i].DueDate != trigger.old[i].DueDate )
{
Add code to change text field say
TxtField='Test MEssage';

}

Does it clarify your question ? Do let me know ..

All Answers

IspitaIspita

Well a one liner answer would be via workflow or trigger ...

But if you provide greater detail one may be able to answer better ...

 

Thanks ...

salesforce1#salesforce1#
Hi lspita,

Thanks for quick reply,
for example
I have a text field (A), date field (d), how can u update a text field based on date field ,can u explain clearly with a small scenario.
skodisanaskodisana
Hi,

Create a workflow rule with the field update actions.
Using formula editor apply below code.
select A as field update and formula as below.

TEXT(d)
IspitaIspita
Hi Balakrishna,
In case you are asking about what will trigger the Workflow/ trigger this is how it is:-
In workflow you will check if the field in question has changes say the field is "DueDate" - there is a function ISCHANGED(fieldname) use that in your workflow rule.
Then defire a field update where change the value of the Text field.
2. Conversely in a trigger you will check the value in:-
if(trigger.new [i].DueDate != trigger.old[i].DueDate )
{
Add code to change text field say
TxtField='Test MEssage';

}

Does it clarify your question ? Do let me know ..
This was selected as the best answer
salesforce1#salesforce1#
Hi lspita,

thank you.