I have found a couple different posts here that are close and I have tried them.
I have a toggle switch that when turned on I want it to set the value in a text input field to the current date and time. I can get this to work using
Patch('RoadSide Event Manager', First(Filter('RoadSide Event Manager', 'Work Order Number'= WOVar)),{On_Scene_Time: Now()});
I am experiencing odd behavior. The toggle is then switched on for every field to automatically be yes, and it updates the time to now every time the form is opened.
The form is opened from a gallery and I need it to pull accurate information from the sharepoint list datasource. So if the value is set to no in the sharepoint list I need it to remain at no until the user sets it to yes. When the user sets it to yes then update On_Scene_Time to the date and time it happens. The tricky part from here is to keep the same value that is in sharepoint first. Then if its already a yes on the toggle leave the value in On_Scene_Time what it was.
Steps needed.
Toggle switch by default on all new records is No.
User reports the activity completed by changing toggle to yes
Once it is marked yes update text input field named On_Scene_Time to date and time now()
Disable toggle so it cannot be changed from yes.
Disable On_Scene_Time so it cannot be edited.
The data source is a sharepoint list and the columns used are Yes/No and Single Line of Text.
Thanks for the help.