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

Check if User Signature exists in SP List

Hello,

I have a SharePoint list that I am customizing it using Power Apps forms.

In a screen inside the form, I have two radio buttons (Add signature, or populate signature).
If the Add signature was selected a Pen-Input box will be displayed for the user to add his signature. The populate signature will lookup for the user signature and populate it inside the form.

What I am trying to achieve is the following:

If the user wants to add his signature and in the users, signatures list a record exist for the User, then I want to ask him to populate his signature else if this user record does not exist I want to patch his handwritten signature.

This is the formula that I am using, but unfortunately, the condition always patches the user signature knowing that there is already a record for this user.

If(Checkbox1.Value=true &&  IsEmpty(LookUp(UsersSignatures, UserName = User().FullName,ImageText)),
   Notify(
      "This item is already signed, you cannot sign it again!", 
      NotificationType.Error
   ),Patch(
      UsersSignatures,
      Defaults(UsersSignatures),
      {
        UserName: User().FullName,
        ImageText:  Substitute(JSON(PenInput2.Image, JSONFormat.IncludeBinaryData), """", "")
      }
      
); Notify(
         "This item has been signed successfully!", 
         NotificationType.Success
      ));

Besides, I have a label text that shows if the user has a signature or not it shows that he doesn't have a signature knowing that the image populates the user signature this means he has a signature.
Capture1.JPG

If(IsEmpty(LookUp(UsersSignatures, UserName = User().FullName, ImageText)),"You have signature","You don't have have signature")

Please have a look at the below screenshots:

Capture.JPGCapture2.JPG
What should be the updated formula to check if the user has a signature or not and if not to store the user signature only once in the list?

Can please someone provide an example and explain it in detail?

Any help will be greatly appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Check if User Signature exists in SP List

Hi @Julien2 ,

Based on the needs that you mentioned, I think the formula I provided above could achieve your needs. Have you renamed the "Title" column in your SP List?

 

I have made a test on my side, and don't have the issue that you mentioned. If the issue still exists, please consider re-create a new SP List, and do not rename the Title column, instead, add a additional Multiple Lines of Text column (called "ImageText") to store the Pen Input image data and a Text column (called "UserName") to store the user name. After that, remove the SP List connection from your canvas app, then re-create a new connection to the new created SP List from your app.

 

After that, try the following formula again, modify your "Submit" button formula as below:

If(
   Checkbox1.Value = true && !IsBlank(LookUp(UsersSignatures_New, UserName = User().FullName, ImageText)),   // Modify formula here
   Notify(
          "This item is already signed, you cannot sign it again!", 
          NotificationType.Error
   );Reset(PenInput2),   // Modify formula here to reset PenInput control
   Patch(
         UsersSignatures_New,
         Defaults(UsersSignatures_New),
         {
           Title: "Uploaded Record_" & Now()
           UserName: User().FullName,
           ImageText:  Substitute(JSON(PenInput2.Image, JSONFormat.IncludeBinaryData), """", "")
        }
   ); Notify("This item has been signed successfully!", NotificationType.Success)
)

 

Modify the formula in your Label Text property as below:

If(
    !IsBlank(LookUp(UsersSignatures_New, UserName = User().FullName).ImageText),
    "You have signature",
    "You don't have have signature"
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Check if User Signature exists in SP List

Hi @Julien2,

Can you try this?

If(Checkbox1.Value=true &&  IsBlank(LookUp(UsersSignatures, UserName = User().FullName).ImageText),
...
<the rest of your code here>
...

Also, there might be an error in the test you posted:

If(IsEmpty(LookUp(UsersSignatures, UserName = User().FullName, ImageText)),"You have signature","You don't have have signature")

Shouldn't it be?

If(IsEmpty(LookUp(UsersSignatures, UserName = User().FullName, ImageText)),"You don't have have signature","You have signature")

As you are saying: If(IsEmpty... then you don't have a signature... else your have a signature.

Or maybe I missunderstood your explanations...

Highlighted
Community Support
Community Support

Re: Check if User Signature exists in SP List

Hi @Julien2 ,

Do you want to check if the current sign in user has owned Signature in your SP List?

 

Based on the formula that you mentioned, I think there is something wrong with it. The IsEmpty function is usually used to check if a Table value is empty, if you just want to check if a specific column of a record in your SP List is blank, I think the IsBlank function would be better.

On your side, you should modify your 

IsEmpty(LookUp(UsersSignatures, UserName = User().FullName,ImageText)

as below:

!IsEmpty(LookUp(UsersSignatures, UserName = User().FullName,ImageText))

or

Not(IsEmpty(LookUp(UsersSignatures, UserName = User().FullName,ImageText)))

Please add a "!" operator before the IsEmpty function or wrap it inside a Not function as above.

 

I have made a test on my side, please consider modify your "Submit" button formula as below:

If(
   Checkbox1.Value = true && !IsBlank(LookUp(UsersSignatures, UserName = User().FullName, ImageText)),   // Modify formula here
   Notify(
          "This item is already signed, you cannot sign it again!", 
          NotificationType.Error
   );Reset(PenInput2),   // Modify formula here to reset PenInput control
   Patch(
         UsersSignatures,
         Defaults(UsersSignatures),
         {
           UserName: User().FullName,
           ImageText:  Substitute(JSON(PenInput2.Image, JSONFormat.IncludeBinaryData), """", "")
        }
   ); Notify("This item has been signed successfully!", NotificationType.Success)
)

 

Modify the formula in your Label Text property as below:

If(
    !IsBlank(LookUp(UsersSignatures, UserName = User().FullName, ImageText)),
    "You have signature",
    "You don't have have signature"
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: Check if User Signature exists in SP List

Hello @v-xida-msft ,

Thanks for your reply. I have modified the submit button, and the label text as you mentioned.

Unfortunately, the label text shows that "I have a signature" knowing that there is no record exist for this user, and the "Add signature" submit button says "This item is already signed.." knowing that I don't have a signature in the Users Signature list this means the condition should enter the "else event" and patch my signature.

Please have a look at the demo below:
Demo.gif

Any clues why this problem continues to appear?

Looking forward to your response.

Thank you!

Highlighted
Community Support
Community Support

Re: Check if User Signature exists in SP List

Hi @Julien2 ,

Based on the needs that you mentioned, I think the formula I provided above could achieve your needs. Have you renamed the "Title" column in your SP List?

 

I have made a test on my side, and don't have the issue that you mentioned. If the issue still exists, please consider re-create a new SP List, and do not rename the Title column, instead, add a additional Multiple Lines of Text column (called "ImageText") to store the Pen Input image data and a Text column (called "UserName") to store the user name. After that, remove the SP List connection from your canvas app, then re-create a new connection to the new created SP List from your app.

 

After that, try the following formula again, modify your "Submit" button formula as below:

If(
   Checkbox1.Value = true && !IsBlank(LookUp(UsersSignatures_New, UserName = User().FullName, ImageText)),   // Modify formula here
   Notify(
          "This item is already signed, you cannot sign it again!", 
          NotificationType.Error
   );Reset(PenInput2),   // Modify formula here to reset PenInput control
   Patch(
         UsersSignatures_New,
         Defaults(UsersSignatures_New),
         {
           Title: "Uploaded Record_" & Now()
           UserName: User().FullName,
           ImageText:  Substitute(JSON(PenInput2.Image, JSONFormat.IncludeBinaryData), """", "")
        }
   ); Notify("This item has been signed successfully!", NotificationType.Success)
)

 

Modify the formula in your Label Text property as below:

If(
    !IsBlank(LookUp(UsersSignatures_New, UserName = User().FullName).ImageText),
    "You have signature",
    "You don't have have signature"
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: Check if User Signature exists in SP List

Hello @v-xida-msft ,

Thanks for your response.

I have followed what you mentioned and it worked as expected.

The issue was from the Chrome browser cache, when I switched to Microsoft Edge it worked properly. It's strange why this happens sometimes.

Thanks again and have a nice weekend!

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,414)