cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Post Prodigy
Post Prodigy

Edit the id in the sharepoint column and show it in powerapps

Hello everyone, 

 

There is the original SharePoint ID column, but I want to create a column to format the ID as:

 

"ID000040" and if it is ID = 1 it will appear like this = "ID000001".

 

Would this be possible in PowerApps?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Gorilla_8 

Your problem there is that you are resetting the form in your button.  This will clear the LastSubmit values.

 

Your OnSelect action of the Save Form button should ONLY be the following:

If(Form1.Valid; SubmitForm(Form1))

 

Your OnSuccess action of Form1 should be this formula:

UpdateIf(teste; 
    ID=Form1.LastSubmit.ID;
    {IDTeste: "ID" & Text(Form1.LastSubmit.ID; "000000")}
);;
ResetForm(Form1)

 

Your OnFailure action of Form1 should be this formula:

Notify("erro"; Error)

 

There is no need (and you don't want to) to reset the form so many times in all the formulas.  The only formula that should reset the form would be the OnSuccess action.   If the Submit fails, you DON'T want to reset the form as the user would then have to re-enter all the information again.  And, you don't want to reset in the Save Form button, as that will clear all the results and the OnSuccess and Failure actions will have nothing to work with.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

18 REPLIES 18
RandyHayes
Super User III
Super User III

@Gorilla_8 

If you are doing this on the creation of a record and are using a Form, then you can utilize the OnSuccess action of the Form and add a formula such as this:

UpdateIf(yourDataSource, ID=yourForm.LastSubmit.ID, 
    {yourOtherColumn: "ID" & Text(yourForm.LastSubmit.ID, "000000")}
)

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Gorilla_8
Post Prodigy
Post Prodigy

@RandyHayes 

 

Thanks for the help, but I tried here, and didn't show the ID

RandyHayes
Super User III
Super User III

@Gorilla_8 

The supplied formula should be working for you.  

Where have you placed the formula and what does your formula look like at this point?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Gorilla_8
Post Prodigy
Post Prodigy

@RandyHayes 

 

I put this code on OnSuccess on the form:

UpdateIf(FichaDeDemanda; ID=FormGeralNew.LastSubmit.ID; 
{IDTeste: "ID" & Text(FormGeralNew.LastSubmit.ID;"[$-pt-BR]000000")}
);;ResetForm(FormGeralNew)
RandyHayes
Super User III
Super User III

@Gorilla_8 

Works great here and your formula looks fine.  So, what kind of column is IDTeste ?

Also, is your form actually submitting successfully? 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Gorilla_8
Post Prodigy
Post Prodigy

@RandyHayes 

 

So, what kind of column is IDTeste ?

 

Its a text simple column

 

Also, is your form actually submitting successfully?

 

yes, it is

RandyHayes
Super User III
Super User III

@Gorilla_8 

I don't know what to tell you... This is a very simple formula that works well.

RandyHayes_1-1611672765412.png

RandyHayes_3-1611672835038.png

 

Are you using SubmitForm to submit the form or are you bypassing that?

 

You can attempt to troubleshoot by placing this in the OnSuccess as well:

UpdateContext({testOut: "ID" & Text(Form1.LastSubmit.ID, "000000")})

Put this as the FIRST line of your formula (before you resetform).

Then after submitting, look at your variables and see what testOut is set to.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
timl
Super User III
Super User III

@Gorilla_8 

This is strange because what Randy says should work correctly.

On the off chance, the only other thing I can suggest to is to wrap your reference to FormGeralNew.LastSubmit.ID in a call to Value, which would ensure that Power Apps recognises that as a number.

UpdateIf(FichaDeDemanda; ID=FormGeralNew.LastSubmit.ID;
         {IDTeste: "ID" & Text(Value(FormGeralNew.LastSubmit.ID);"[$-pt-BR]000000")}
);;
ResetForm(FormGeralNew)

 

Gorilla_8
Post Prodigy
Post Prodigy

@RandyHayes  and @timl 

Didn't work for me guys...

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (52,561)