cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johnc222
Helper III
Helper III

OnChange to update sharepoint listitem

Hello trying to make a TextInput display a current value from a sharepoint list item, 

 

But i want user to be able to simply click on input and type something new in or add to it. Due to the way i am checking for the record - i would like to display by default the current record text ( comments ). 

 

I tried to edit the OnChange field to use an UpdateIf and Match to compare and find the correct record - but it does not like the way I am doing this. Anyone able to help here? i am kind of stumped. Need to make sure the current label is also the same "trailer record" that its updating so this data follows the trailer if it moves location.

 

johnc222_0-1622839115081.png

OnChange

UpdateIf('Trailer Tracking', Match('374B1TrailerLabel'.Text,Trailer.Value), Comments.Text = '374B1Comments'.Text);

Default

 LookUp('Trailer Tracking', Building.Value = "374" && Dock.Value = "B1" && '374B1TrailerLabel'.Text = Trailer.Value, Comments)

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @johnc222 ,

Are you simply trying to update the current record with the new comments?

UpdateIf(
   'Trailer Tracking', 
    Trailer.Value='374B1TrailerLabel'.Text,
    {'374B1Comments':Comments.Text}
}

You can also use Patch

Patch(
   'Trailer Tracking', 
    {Trailer.Value:'374B1TrailerLabel'.Text},
    {'374B1Comments':Comments.Text}
}

I am assuming here Trailer is a Choice field (not a Lookup)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

8 REPLIES 8
zmansuri
Super User
Super User

UpdateIf('Trailer Tracking', Match('374B1TrailerLabel'.Text,Trailer.Value), {Comments.Text = '374B1Comments'.Text});

You need to write the filed you are updating in curly bracket

WarrenBelz
Super User
Super User

Hi @johnc222 ,

Are you simply trying to update the current record with the new comments?

UpdateIf(
   'Trailer Tracking', 
    Trailer.Value='374B1TrailerLabel'.Text,
    {'374B1Comments':Comments.Text}
}

You can also use Patch

Patch(
   'Trailer Tracking', 
    {Trailer.Value:'374B1TrailerLabel'.Text},
    {'374B1Comments':Comments.Text}
}

I am assuming here Trailer is a Choice field (not a Lookup)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi WarrenBelz,

 

It appears both of those snippets are still showing as an error. Yes - i want it to compare the value the trailer currently showing in dock B1 is the same record in the sharepoint list - then change the comment text string if user types anything in the text input

 

johnc222_0-1622849654512.png

 

Hi @johnc222 ,

What type of field is Trailer? I was simply using the values you posted (the syntax is correct for both the Patch and the UpdateIf). If it is a Text field, you do not need the .Value.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Yes Trailer is choice, believe it is also index'ed so there are no duplicates. 

Looks like for the UpdateIf it only has the Comments.Text underlined. I thought this is correct as it is just a single line of text 

Hi @johnc222 ,

What does the error say?

WarrenBelz
Super User
Super User

Hi @johnc222 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,001)