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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set variable not working
Power Apps
Answered

Set variable not working

(0) ShareShare
ReportReport
Posted on by 19

Hi, 

 

I am working on my first PowerApp, I have never done anything like this before so I am trying to learn as I go along. 

 

I am trying to pass details from a form onto the next page through variables. I already had this working, but I have had to revisit it and add another variable. 

 

The OnSelect. of the form contains: 

 

Set({selectedIssueNO : ThisItem.TicketKey, selectedSubject : ThisItem.Subject, selectedDescription : ThisItem.Description, selectedAssignedTo2 : ThisItem.AssignedTo}) ; UpdateContext({selColor : RGBA(255, 0, 0, 1)}) 

 

This was working at first, but now when I have tried to add another variable PowerApps is not picking up the new variable. 

 

Set({ selectedIssueNo : ThisItem.TicketKey , selectedSubject : ThisItem.Subject , selectedDescription : ThisItem.Description , selectedAssignedTo : ThisItem.AssignedTo}) 

 

The last variable 'selectedAssignedTo' will not set, and I can't figure out why. 

 

I have added a label on the same screen and set the text as 'selectedAssignedTo' but the variable is not appearing in the list, and coming back with a 'Name isn't valid' error. 

 

Any help would be appreciated, I have been scratching my head over this for a while. 

 

 

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Tyrrell94,

    Does the first formula that you provided work well within your app?

     

    Based on the formula that you provided, I think there is something wrong with the Set function within the formula that you provided.

    The standard formula format of the Set function as below:

    Set( VariableName, Value )

    On your side, you should modify your formula within the OnSelect property of a Button control  (or other controls) as below:

    Set(
    CurrentRecord,
    {
    selectedIssueNO : ThisItem.TicketKey,
    selectedSubject : ThisItem.Subject,
    selectedDescription : ThisItem.Description,
    selectedAssignedTo2 : ThisItem.AssignedTo
    }
    );
    UpdateContext({selColor : RGBA(255, 0, 0, 1)})

    If you want to reference the selectedAssignedTo2 property, you should type the following formula (e.g. Set Text property of a Label control to following):

    CurrentRecord.selectedAssignedTo2

    More details about the Set function within PowerApps, please check the following article:

    Set function

     

    Best regards,

    Kris

  • Tyrrell94 Profile Picture
    19 on at

    Hi Kirs, 

     

    You had been right, I just had the syntax wrong. 

     

    I have now changed it to the following and it works fine. 

     

    Set(selectedAssignedTo , ThisItem.AssignedTo) 

     

    Thanks for your response! 

     

    Regards,

    Andrew

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard