cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kadd
Resolver III
Resolver III

Patching multiple contacts to text field

Hello,

 

hope you are all doing good.

 

so i have an issue with a form in a SharePoint list. Strangely that was working when i put it in place a few weeks ago and now i get an error message.

 

I have a People field that allows multiple people and a text field that should hold the value of the selected people but also those that have potentially been identified before.

 

Kadd_0-1637830325195.png

 

what happens here is that i use the first field "Risk Assessment Contacts serach" to look up for my users and when i save the form, the Patch function should concatenate the display name of the selected users with the display names already existing  in field "Risk assessment contacts" (Text field) .

 

So I collect the users from the combobox  using this formula :   (this part works, i see my users in my collection)

 

 

//Collects the email addresses of all the people added to field "Risk Contacts"
ForAll(
    RiskContactValue.SelectedItems,
    Collect(
        CollRiskContacts,
        {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Claims: "i:0#.f|membership|" & ThisRecord.Email,
            Department: "",
            DisplayName: ThisRecord.DisplayName,
            Email: ThisRecord.Email,
            JobTitle: ".",
            Picture: "."
        }
    )
);

 

 

and in my Patch function, i have ...

 

RiskContactTxt: RiskContactTxtValue.Text & Concat(CollRiskContacts,DisplayName & " "),

 

(where RiskContactTxt is the name of my text field in my list and  RiskContactTxtValue is the name of my control)

 

...I know the Patch itself works because if i remove this part, everything is fine but if i keep this line in the Patch function, i have an error saying "an unknown error occurred. Server response :  " ... and nothing else... that's not really explicit 😅

 

Would someone have an idea how i could solve this issue ...please ? 

Again it's wierd because it was working very well for some time....

 

thanks  a lot for your time

 

3 REPLIES 3
gabibalaban
Dual Super User
Dual Super User

@Kadd ,

Have you tried to previously put the value in a context variable and inside the patch to put that context variable ? 

Is there any chance that the length of the text value you want to patch to be greater than 255 chars ? 

 

Hello @gabibalaban ,

 

hmm...it doesn't seem to be working. i did this...i put it before the Patch :

 

UpdateContext({varRiskContact:RiskContactTxtValue.Text & Concat(CollRiskContacts,DisplayName & " ")});

 

and in the Patch i have this

RsickContactTxt: varRiskContact

 

but the error is still the same 😞

 

it's just a few names usually like 3 or 4 so it's not more than 255 characters. 

 

if you have any other idea ...?

 

Thanks

Kadd
Resolver III
Resolver III

Hello all,

 

so i partially solved my issue.

As i said, the formula used for my people fields was working before so i know it's correct.

 

I removed it from the main Patch (where i patch all my fields) and i put it after my collection formula (the one i copied in my first message ...so i have 1 additional patch per People field (i have 3 of them).

 

Now it works...and...it doesn't.  Strangely, when i click my button it populates the collection, it saves the users to my text field BUT it doesn't save the data from my main patch, it just reinitializes the fields to the previous value (so my comment field where i wrote "aaa" at first and "bbb" when i added my users is reset to "aaa".

But if i then edit all my fields again ...without adding people in my people fields... then it correctly saves all the fields i edited.

 

so it's like saving now is done in 2 parts... either the people or the fields but never all at once. this is really strange cause i have this problem nowehere else in my other forms.

 

did someone see that behaviour before ? does someone have an idea ?

 

Thanks a lot for your time 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,617)