Hi Experts,
Hopefully an easy one for you.
I have an app and sharepoint list, in the sharepoint list there is a column called Response, when the user presses the submit button, it will patch some information into the record that has been selected. I want it to put the date and time now into the Response column but only if the Response column is blank, if it has a date and time already in it then I don't want it to be overwritten. Is that possible please? Below is my current snippet for patching that column
Patch(TicketingSystem,
'Gallery-Tickets'.Selected,
{
Status:'Dropdown_Status_1'.Selected.Value,
Response: Now(),
Thanks in advance,
Dave
try DateTimeValue(yourResponseResult)
Hi @anandm08
I'm getting the following error now:
The type of this argument 'Response' does not match the expected type 'Date'. Found type 'Text'.
Regards
Dave
@Dave-ITMan try this code:
Patch(
TicketingSystem,
'Gallery-Tickets'.Selected,
{
Status: 'Dropdown_Status_1'.Selected.Value,
Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Text(Now(), "[$-en-US]yyyy-mm-dd hh:mm:ss"), 'Gallery-Tickets'.Selected.Response)
}
)
Hi @anandm08
It is the correct time zone, the default created column is showing correctly. If I put the Response column to friendly time, it's showing 12 hours ago so it's patching it as AM and not PM and not picking up the minutes.
I also have another bit of code in the patch which is below and the TicketReponses is showing the correct date and time in sharepoint
Patch(TicketingSystem,
'Gallery-Tickets'.Selected,
{
Status:'Dropdown_Status_1'.Selected.Value,
Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Now(), 'Gallery-Tickets'.Selected.Response),
TicketResponses: User().FullName & " - " & Now() &":
" & 'TextInput-Response'.Text & "
" & Char(13)& 'Gallery-Tickets'.Selected.TicketResponses});
check you SharePoint site time zone may be it is not set to your local time zone
Hi @anandm08 ,
Thanks for quick response, When that submits to sharepoint it is showing the time as 01:00pm but it should have been 01:02pm, do you know why it isn't giving me the correct minutes please?
Thank you
Dave
hi @Dave-ITMan ,
Yes, it is possible to patch the date and time into the Response column only if it is currently blank. You can use the If function to check if the Response column is blank before updating it. Here’s how you can modify your current snippet:
Patch(
TicketingSystem,
'Gallery-Tickets'.Selected,
{
Status: 'Dropdown_Status_1'.Selected.Value,
Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Now(), 'Gallery-Tickets'.Selected.Response)
}
)
Try this:
Patch(TicketingSystem,
'Gallery-Tickets'.Selected,
{
Status:'Dropdown_Status_1'.Selected.Value,
Response:If('Gallery-Tickets'.Selected.Response <>Blank(),Now())
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,957
Most Valuable Professional