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 / Error for Primary key ...
Power Apps
Unanswered

Error for Primary key in PowerApps

(0) ShareShare
ReportReport
Posted on by 388

Hi,

 

Created powerapps application and storing data to Oracle. Application is creating new record in Oracle table without any issue but I am getting the following error after submitting the application.

 

tempsnip.png

 

Here is the code for PrimaryKey datacard value om Submitbutton.

 

Refresh('[DatabaseName].[TableName]');
UpdateContext({sID: First(Sort('[DatabaseName].[TableName]', ID, Descending)).ID + 1});

 

Can anyone please let me know suggestion to get rid of this error?

Any help would be greatly appreciated.

 

Thank you

 

Categories:
I have the same question (0)
  • GarethPrisk Profile Picture
    2,828 on at

    Looks like the data being submitted to Oracle is violating a primary key that someone setup.

    I am not an Oracle expert, but this should get you started (or someone else), to further understand the requirements of the PK.

    https://stackoverflow.com/questions/9689412/issue-ora-00001-unique-constraint-violated-coming-in-insert-update

     

  • GarethPrisk Profile Picture
    2,828 on at

    Oops - responded a bit quickly.

     

    In your code, it looks like you're trying to force the 'PrimaryKey' column to be the ID's max value incremented by 1? Is this valid?

     

    What the actual column tied to the PrimaryKey card, is it the ID column? Can you set that manually in Oracle?

     

    I would ensure you have an accurate value first. I suspect you are trying to Refresh the table, to ensure you have the latest data, before determining what the value should be. I would switch this to be a variable or a collection.

     

    Is the function you noted on the Update property of the DataCard for the PrimaryKey field? Or is that mapped to the context variable (sID)?

     

    I don't think the Refresh function will work as you expect. It will trigger it but it doesn't wait for it to finish, in my experiences, before moving onto the next function. You shouldn't need it. The simply act of setting the variable makes an explicit call.

     

  • OK29 Profile Picture
    388 on at

    Removed refresh function still I am facing same issue but record is being created with no issue. Is there anyway to turn off the error message display on the banner?

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
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard