web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set Value of Field on ...
Power Apps
Unanswered

Set Value of Field on Submit to Concat Values from a 2 Different Fields + Text String

(0) ShareShare
ReportReport
Posted on by 10

Greetings,

 

As the Subject line says, I am trying to figure out how to set a field value, [RequestName] to equal the values of two other fields [LastName] and [FirstName] plus a text string. 

 

I routinely did this with InfoPath Custom List forms but it doesn't seem as straight forward in PowerApps, though this is the first time I have tried to use PowerApps.

 

The end result would be something where the [RequestName] field ends up being "New Transaction Request For "&[LastName]& ", "& [FirstName]. 

 

I have put that in the as the field's default value setting, but that doesn't work on Save. If I open the list item back up and save it, it will show update the [RequestName] field.  I need this to get set on the initial form submission.

 

Any help would be greatly appreciated. Thanks....B

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @Bart_S ,

    The issue is probably around the Update setting for the DataCard in which this control is placed. Assuming the target field is a Single Line of Text, set the Update to (replace with your name)

     

    "New Transaction Request For " & YourLastNameControl.Text & ", " & YourFirstNameControl.Text

     

     

    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.

     

  • v-xida-msft Profile Picture
    on at

    Hi @Bart_S ,

    Could you please share a screenshot about your app's Edit form configuration?

     

    Based on the needs that you mentioned, I think the Update property of the RequestName field data card in your Edit form could achieve your needs.

     

    Please set the Update property of the RequestName field data card in your Edit form to following:

    "New Transaction Request For " & LastNameTextInput.Text & ", " & FirstNameTextInput.Text

    Set the Default property of the RequestName TextInput box to following:

    If(
     EditForm1.Mode = FormMode.New,
     "New Transaction Request For " & LastNameTextInput.Text & ", " & FirstNameTextInput.Text,
     Parent.Default
    )

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Bart_S Profile Picture
    10 on at

    Thanks Warren,

     

    I did modify the Update function for the data card.  On the initial submit, it behaves the same way.  It does not concatenate the Last Name and First Name field values on the initial save. 

     

    Following the initial save, if I simply open the item in edit mode, make no changes, click save, it will do the concatenation.

     

    So it appears at the time the Update function is executed on the new item creation, it sees the FirstName and LastName fields as being null. 

     

    Again, first time toying around with PowerApps after using InfoPath for many years. I'm sure it is something simple I am not seeing.

     

     

  • Bart_S Profile Picture
    10 on at

    Thanks Kris,

     

    I did change the Update function for the [RequestName] field's data card and set the Default Property as indicated.

     

    The form submit behaves the same.  The RequestName field on save has the value of "New Transaction Request For " and doesn't concatenate in the LastName and FirstName field values.

     

    If I then edit that list item, make no changes, simply save, the concatenation occurs and the RequestName field has the value of "New Transaction Request For LastName, FirstName".

     

    It would seem that the change on the RequestName field would need to happen on save or on a change to the FirstName and LastName field values.  Just not sure how to make that happen where it sticks on the initial save.  Otherwise, whenever the Default or Change functions are triggered for RequestName field, the field values for LastName and FirstName are still null.

     

    B.

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @Bart_S ,

    Strange, but try this workaround

    On the OnChange property of both the First Name and Last Name Controls, set Variables (example)

    UpdateContext({vFirst:YourFirstNameControl.Text})

    Then on the Update of the Card

    "New Transaction Request For " & vFirst & ", " & vLast

     

    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.

     

  • Bart_S Profile Picture
    10 on at

    Hi again Warren.  Thanks again for taking the time to offer me help.

     

    I did try this, but it doesn't seem to set the variables.  I even added another text field and set its' default value to one the variables and it didn't set.  Nor was this like a the previous attempts where the process worked when a opened the newly created item back up in Edit mode and saved.

     

    This is just a simple list with three columns to test with.  The RequestName field is the default Title field I rename in a lot of my lists as that field is used to open the item and I make the content descriptive for the user.  I've always set the value of the this field to be concatenation of multiple fields and I use that field in workflow emails, etc.

     

    Odd.  More odd is I am able workaround this by having a Flow trigger on submit which starts off creating a variable called VarSetRequestName with the value of the variable set to a string concatenating "Transaction Request for [FirstName] [LastName]" and then used the Update Item action to set the RequestName field to the VarRequestName variable.

     

    I've attached screenshots showing what I did on the OnChange properties for the FirstName and LastName controls along with the Update property change on the RequestName card.  If something looks amiss, let me know.  This is bugging me as this was such a simple thing that I could do in InfoPath.

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Ok @Bart_S ,

    Let's try something different.

    On the Save process try a Patch

    Patch(
     YourDataSourceName,
     Defaults(YourDataSourceName),
     {
     RequestName:
     "New Transaction Request For " & 
     LastNameTextInput.Text & ", " & 
     FirstNameTextInput.Text,
     OtherDataField1:OtherControlOutput1 //and so on for the rest
     }
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Bart_S ,

    Based on the screenshot that you mentioned, I think you have some misunderstanding with my solution I provided above.

     

    When you set value for the Default property of the RequestName field Text Input box, please reference the LastName field and FirstName field data card value (e.g. DataCardValue1.Text) directly. The DataCardValue should be like below in your Edit form:

    2.JPG

     

     

    So please set the Update property of the RequestName field data card in your Edit form to following:

     "New Transaction Request For " & DataCardValue2.Text & ", " & DataCardValue3.Text

    Set the Default property of the RequestName field Text Box to following:

    If(
     SharePointForm1.Mode = FormMode.New,
     "New Transaction Request For " & DataCardValue2.Text & ", " & DataCardValue3.Text,
     Parent.Default
    )

    Note: The DataCardValue2 represents the Text Input box within the LastName field data card. The DataCardValue3 represents the Text Input box within the FirstName field data card. Please replace it with actual control name within your Edit form. Please do not type LastName, FirstName directly within above formula

     

    If above issue still exists, I think the Patch function could also achieve your needs. Please set the OnSuccess property of the SharePointForm1 to following:

    Patch( // Add formula here to update the RequestName field in your SP List
     'Your SP List',
     SharePointForm1.LastSubmit,
     {
     RequestName: "New Transaction Request For " & SharePointForm1.LastSubmit.LastName & ", " & SharePointForm1.LastSubmit.FirstName
     }
    );
    ResetForm(SharePointForm1);
    RequestHide()

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @Bart_S ,

    A couple of paths for you here - please tag whoever you want to continue the thread with.

  • Bart_S Profile Picture
    10 on at

    @v-xida-msft  and @WarrenBelz 

     

    Thank you guys for your help.  Kris, your last clarification helped and I did get this to work.  My mistake was exactly what you thought it was.  I was typing the field name (which resolved in the function setting without a error flag) when it should have been the DataCardValue.  In this case I was typing LastName and FirstName instead of DataCardValue2.Text and DataCardValue2.Text.

     

    Again, thanks.

     

    Bart

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard