LawrenceLoz / FormulaShare-DX

A native app to support complex Salesforce sharing with quick and easy configuration
MIT License
56 stars 17 forks source link

Share record to be inserted wasn't detected in query #80

Closed SaschaLoeffler closed 2 years ago

SaschaLoeffler commented 2 years ago

What is above error message about? We cant find out, what is the issue with the current approach and dont understand the reason of this error occurs? Object Sharing is Private and we are sharing with a public group.

LawrenceLoz commented 2 years ago

Hi @SaschaLoeffler

The explanation of this error is in the help guide (https://cloudsundial.com/formulashare-errors-and-warnings):

Implies that FormulaShare was called and identified that a share record should be created for the record, but that the asynchronous process which checks for sharing after the transaction has finished couldn't find the expected share record. This could suggest the insert line of the trigger code calling FormulaShare didn't run correctly.

Is your trigger code set up as per the example here? https://cloudsundial.com/trigger-setup

Assuming you have the insert line included, could you please check using debug statements whether the sharing record details being returned by helper.getSharesToInsert() include what you think they should, and check whether the insert is happening as expected? (by checking using the Sharing button on the page or querying the relevant share object)

If you're still having trouble it would be useful to know whether the sharing is being created as you'd expect, and also whether you're using the AppExchange package or the open source code - let me know any more details around the context if you need help to investigate

SaschaLoeffler commented 2 years ago

Hi @LawrenceLoz thanks for your reply, we have checked this.

This our Trigger Code:

trigger LeadTrigger on Lead (After insert, After Update, after delete, after undelete) {

    sdfs.FormulaShareHelper helper = new sdfs.FormulaShareHelper();
    insert helper.getSharesToInsert();
    delete helper.getSharesToDelete();

}

Seeing that, i would say that the trigger is setup as your example. The Share record is created with the correct UserOrGroupId, but the user is not able to access the record. image

If you're still having trouble it would be useful to know whether the sharing is being created as you'd expect, and also whether you're using the AppExchange package or the open source code - let me know any more details around the context if you need help to investigate -> We are using the AppExchange package.

LawrenceLoz commented 2 years ago

Hi @SaschaLoeffler thanks for the extra detail.

The trigger does look like it's set up correctly, and the fact that the share record looks right suggests the insert is working OK. The share records for standard objects should be the same as if they were created using manual sharing (adding a user or group using the 'Sharing' button from the record page) - it may be worth checking that you can add manual sharing using the button for the user and seeing if this works OK?

I'm happy to take a look if you can grant access to FormulaShare support in a sandbox? https://help.salesforce.com/s/articleView?id=sf.granting_login_access.htm&type=5

SaschaLoeffler commented 2 years ago

Hi Lawrence, I have checked this again and for the record I checked the share record was there, but after trying to create a new lead and checking the share records, there was only the owner share record and no manual sharing record. So before giving access to a Sandbox I want to ask you how to see / check, why the share record is not created? I tried to see from debug, but i can't find anything. Thank you! Have a great weekend

Lawrence Newcombe @.***> schrieb am Sa., 28. Mai 2022, 11:02:

Hi @SaschaLoeffler https://github.com/SaschaLoeffler thanks for the extra detail.

The trigger does look like it's set up correctly, and the fact that the share record looks right suggests the insert is working OK. The share records for standard objects should be the same as if they were created using manual sharing (adding a user or group using the 'Sharing' button from the record page) - it may be worth checking that you can add manual sharing using the button for the user and seeing if this works OK?

I'm happy to take a look if you can grant access to FormulaShare support in a sandbox? https://help.salesforce.com/s/articleView?id=sf.granting_login_access.htm&type=5

— Reply to this email directly, view it on GitHub https://github.com/LawrenceLoz/FormulaShare-DX/issues/80#issuecomment-1140216777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFK5GGPYBLHY6SQZRCX7V3VMHOK3ANCNFSM5W5EMLXA . You are receiving this because you were mentioned.Message ID: @.***>

LawrenceLoz commented 2 years ago

Hi @SaschaLoeffler, it's hard to investigate more without access or more detailed info - this is a relatively generic error which suggests FormulaShare ran during a trigger, determined a share should be instered, but then couldn't find this inserted afterwards. This is usually to do with the way insertion is happening outside of the package but your trigger looks OK so it may be something within the app code.

It's probably simplest for me to take a look in a sandbox, otherwise if you send full details of how the rule and any formula fields it uses are configured, screenshots of records being created and screenshots of the logs I might be able to spot something (but it also might not be clear from these if it's something around the app itself)

LawrenceLoz commented 2 years ago

Hi @SaschaLoeffler, just checking if you're still having trouble getting this rule working and whether you'd like me to take a look?

LawrenceLoz commented 2 years ago

Closing as needs further details to investigate. @SaschaLoeffler feel free to create a new issue with more context if this is still a problem