I am attempting to use Patch to update a record within CDS. I just want to update a Date/Time field.
Here is what I have tried and some info:
Patch(
MyPerson,
DataTable.Selected.Person,
{
Column: DateAdd(Now(),3,Days)
}
)
I am sure there are many more that I have tried, but this is driving me nuts lol
Any help is definitely appreciated.
Solved! Go to Solution.
@CNT Just attempted and nothing, I am really unsure why.
@mdevaney Thanks for the reply but I had mentioned I attempted that but I did just attempt again just to be sure I typed it in correctly and no go.
I did get it resolved using an UpdateIf, I am unsure why the Patch would not work. Here is my final code that is working.
UpdateIf(
MyPerson,
Person=DataTable.Selected.Person,
{
Column: DateAdd(Now(),3,Days)
}
)
I am usually hesitant using UpdateIf as it can change multiple records, but as I'm calling the GUID I am safe-ish lol. =P
My apologies, nothing happens, no data saved, nothing edited.
I used Errors() as well and nothing
@Bahalzamon I tried and it seems to work. Just to check it on your side, do the following and check if updates the first record.
Patch(
MyPerson,
First(MyPerson),
{
Column: DateAdd(Now(),3,Days)
}
)
I believe the 2nd argument is your problem. Try this instead.
Patch(
MyPerson,
LookUp(MyPerson, Person=DataTable.Selected.Person),
{
Column: DateAdd(Now(),3,Days)
}
)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
@CNT Just attempted and nothing, I am really unsure why.
@mdevaney Thanks for the reply but I had mentioned I attempted that but I did just attempt again just to be sure I typed it in correctly and no go.
I did get it resolved using an UpdateIf, I am unsure why the Patch would not work. Here is my final code that is working.
UpdateIf(
MyPerson,
Person=DataTable.Selected.Person,
{
Column: DateAdd(Now(),3,Days)
}
)
I am usually hesitant using UpdateIf as it can change multiple records, but as I'm calling the GUID I am safe-ish lol. =P
User | Count |
---|---|
160 | |
96 | |
76 | |
72 | |
59 |
User | Count |
---|---|
213 | |
166 | |
97 | |
95 | |
75 |