Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to set a default value of Edit New Form only

(0) ShareShare
ReportReport
Posted on by

I am developing an app in Teams power app

 

I am trying to use the below code on the default value of edit form field by this code,

(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1
this I applied to bring the Last Value +1 for my counting's requirement
 

It works fine and bring the correct result, But keep value applied all the time. even in the other records. Till it is closed.

BUT I want to value to be brought only if the form is in NEW mode. I mean while entering the new record

tried by FormName.FormMode check, but not work.

 

Please guide a correct way to approach the same formula for the requirment

 

 

MIA27_0-1709873614623.png

 

MIA27_1-1709873752897.png

 

 

 

 

  • Verified answer
    Samuel-Zhou Profile Picture
    393 on at
    Re: How to set a default value of Edit New Form only

    @MIA27 Try this,

    If(Form1.Mode=1,(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1,Parent.Default)

     

  • MIA27 Profile Picture
    on at
    Re: How to set a default value of Edit New Form only

    The code has not error, but the result is not required.

    For new it bring the calculation as required,

    But when the edit form is reset, or on the previous any old record, then record field value is blank, which it should not be.

    Requirement is if new then fetch the calculation, for rest no need, it to be remained as it,

    pls. check my below images and advise

     

    MIA27_0-1709877447505.pngMIA27_1-1709877459886.png

     

     

  • Samuel-Zhou Profile Picture
    393 on at
    Re: How to set a default value of Edit New Form only

    Hi @MIA27 Try this code in Default,

    If(Form1.Mode=1,(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1)

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard