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 / Pass form input value ...
Power Apps
Unanswered

Pass form input value to global variable

(0) ShareShare
ReportReport
Posted on by 76

I have an app for processing staff onboarding.  There is a form to begin a new onboarding where only the staff name is entered.  The form has a single data card.  The submit button has the following OnSelect:

 

SubmitForm(NewOnboarding_1);
Set(varNewOnboardingName, DataCardValue10_1);
Notify("Your updates have been saved", NotificationType.Success);
Office365Outlook.SendEmail("email address", "Notice: New Staff Onboarding", Concatenate("A new onboarding has been started for ", varNewOnboardingName), {Importance:"Normal"});
ResetForm(NewOnboarding_1);
Set(varOnboardingVisible, false);
Refresh('Employee Onboarding')

 

I removed the actual email address for the purpose of sharing the OnSelect property, but trust me that the email does send.  What I'm struggling with is getting the varNewOnboardingName value into the email.  I know something is not right with setting the variable value but haven't been able to work out what it is.  Can anyone help?

Categories:
I have the same question (0)
  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    Hi @StaceyGriffeth , What is control that you are using within the data card: DataCardValue10_1? So. let say that it is Combo box. Then the code should be :

     

    Set(varNewOnboardingName, Combobox.Selected);

     

    If it is not combo box and it is just InputText control then this code will work:

     

    Set(varNewOnboardingName, InputText.Text);

     

    Example: In below screenshot, I have a Form1 and in that I have datacard named as Title_DataCard2 and within that I have DataCardValue5 as text input control

    ANB_0-1706882315312.png

    For me the code will be 

     

    Set(varNewOnboardingName, DataCardValue5.Text);

     

     

    And the final code will be 

     

     

    Office365Outlook.SendEmail(varNewOnboardingName, "Notice: New Staff Onboarding", Concatenate("A new onboarding has been started for ", varNewOnboardingName), {Importance:"Normal"});

     

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    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.👍

    Thanks,
    ANB


  • StaceyGriffeth Profile Picture
    76 on at

    Hi @ANB it is an Input Form with a single field from my data source (Sharepoint List).  The form is called NewOnboarding_1.  It has a single data card, Title_DataCard2_1, and the value is DataCardValue10_1.  So would it be DataCardValue10_1.text?

  • Jiis Profile Picture
    254 Moderator on at

    Your current formula Sets varNewOnBoardingName to a record but the SendEmail function needs text.

    To fix it change 

    Set(varNewOnboardingName, DataCardValue10_1); to Set(varNewOnboardingName, DataCardValue10_1.Text);

     

    Also I recommend moving the formula to Form.OnSuccess. Incase the submission isnt successful

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @StaceyGriffeth Updated my previous response.

     

    Set(varNewOnboardingName, DataCardValue10_1.text);

    Also, that should be email address. Not name.

     

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    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.👍

    Thanks,
    ANB


  • Jiis Profile Picture
    254 Moderator on at

    No it shouldn't because they are using the variable only for the email body

  • StaceyGriffeth Profile Picture
    76 on at

    @ANB @Jiis  I updated the code as follows and moved it to the OnSuccess property of the form itself, but the email is still not including the name entered into the form.  I did confirm the value was successfully submitted back to the data source.

     

    Set(varNewOnboardingName, DataCardValue10_1.Text);
    Office365Outlook.SendEmail("email address", "Notice: New Staff Onboarding", Concatenate("A new onboarding has been started for ", varNewOnboardingName), {Importance:"Normal"});

  • Verified answer
    Jiis Profile Picture
    254 Moderator on at

    Just for clarification what control is DataCardValue10_1? Text Input or Combobox/Dropdown?

     

    Also might be because now submission is being sent before variable can be set

    Move Set(varNewOnboardingName, DataCardValue10_1.Text); back to the Submit button

    And before the SubmitForm formula

     

  • StaceyGriffeth Profile Picture
    76 on at

    @Jiis That fixed it!  It was because of the order, moving the Set Variable before Submit Form fixed the issue.  Thank you!

  • Jiis Profile Picture
    254 Moderator on at

    Im glad i could help!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard