keirbowden / sigcapapp

Signature Capture Samples
MIT License
9 stars 5 forks source link

Save Failed: Null - aura component #25

Closed Shubedobedo closed 3 years ago

Shubedobedo commented 3 years ago

When added to an aura component: I get the following alert after trying to save the signature. image

Used it on a page as a component and it worked fine.

Code of component that seems to be the issue:

Shubedobedo commented 3 years ago

Did some more testing. This is happening in a community. If I log in as an admin it works so I am guessing it is a permission issue. The user has full edit access to the object thought. So not sure what the issue is.

keirbowden commented 3 years ago

Thanks for the report.

The save failed message is a weird one - I can't see from the controller code how that message could be generated, although clearly it is!

Does the signature image get saved when you see this error?

Can you tell me a bit more about the community page - what the application record is and how it is accessed?

Shubedobedo commented 3 years ago

The signature image does not get saved. The community page itself is pretty basic it just has an aura component on it. The component finds an application related to the user(a customer object) loads it the allows them to edit it, They have full edit access to it. That being said I tried to hard code the record id into the sig block and get the same error.

Shubedobedo commented 3 years ago

opened a case with salesforce sonce I'm pretty sure it is a permission issue. They came back with "Everything permission wise looks great. I took a look at the component and ran a test. It appears as though this has to do with a managed package called BrightSIGN. Your best bet would be to reach out to the package developer for debugging as I don't know why it would be coming back as null."

keirbowden commented 3 years ago

I'll have a go at reproducing over the weekend. The permissions are checked server side so I'd expect a clear error message, but maybe the community side of things is interfering somehow. The call to the server returns success, but a null result, which makes me wonder if there's an error that isn't being trapped.

Shubedobedo commented 3 years ago

Ok. Let me know if there is anything I can do to help.

keirbowden commented 3 years ago

A thought - what license are you using when you get the error? If you are saving Files as opposed to Attachments, AFAIK Customer community doesn't have access to content, which is how Files work under the hood (https://trailblazer.salesforce.com/ideaView?id=08730000000l1vaAAA). If you are using customer community, can you try with a customer community plus license and see if it works? The other option is to switch to attachments.

Shubedobedo commented 3 years ago

The license being used is customer community plus. I can try to switch it to attachments. How do I do that?

keirbowden commented 3 years ago

So it actually defaults to attachments, which still could be an issue if the communities setting to allow customer users access to notes and attachments isn't enabled.

Can you try switching to Files, as the customer community plus license should allow that. You do this by specifying the attribute saveAttachment="false"

Shubedobedo commented 3 years ago

Just gave it a shot and the same issue when running as a community user. I also tried it as admin and it did go through as a file.

keirbowden commented 3 years ago

Thanks for giving it a shot. Back to the drawing board.

keirbowden commented 3 years ago

I've been trying to reproduce this all morning but no dice. This was a new developer edition using a Customer Community Plus license. I created a new custom object (Signature Holder) and a test record. My customer community plus user was given access to the sobject type via a permission set.

I then created a lightning component that instantiated a BGSIGCAP:SignatureCapture component and passed it the ID of the test record, and added this to my community home page. I then tried all sorts of things to break it, but I couldn't get the null value that you are seeing. For reference I had :

I also tried adding a trigger on attachments and generating catchable and non-catchable exceptions, and in all cases I got a friendly error message explaining what the problem was.

I can't think of anything else I can try, so I'd suggest you try a few more scenarios and see if you can get any more information out of your instance:

Shubedobedo commented 3 years ago

I haven't done the debug yet but I created a new coponent that is the only thing on the page it is just this : <aura:component description="tEST" implements="forceCommunity:availableForAllPageTypes,lightning:actionOverride" access="global">

<BGSIGCAP:SignatureCapture recordId="a1Br0000002Xh2uEAC" saveAttachment="false" />

</aura:component>

Still getting the same error

Shubedobedo commented 3 years ago

I also created a new object that the user doesn't not have permission to. Still get that error. I was hoping for an error about no permission but nope.

keirbowden commented 3 years ago

That is the first thing checked, so it sounds like it isn't hitting the controller correctly. Can you check the profile has access to the BrightSIGN controller class? I just tested that and got a friendly error, but it's worth a look.

Shubedobedo commented 3 years ago

Wow. That was the issue. I am sure confused because this worked about a year ago and no one removed access to that class.

Feel free to close though. I was looking all over for permission issues never even dawned on me to look at apex class for the controller. Thanks a lot.

keirbowden commented 3 years ago

Great to hear. There was an update enforced around the last Salesforce release that meant you had to explicitly grant access to the controller classes of aura components, so maybe that took it away.

I still don't understand why my user got an friendly error rather than null, but mine is a new org so no update applied.

Quite the journey, but we got there in the end!