I can’t quite figure out how to setup a process to delete a BF user account if they haven’t been setup in the FMS side. For example, if user attempts to create an account in the BF portal AND there is not a corresponding user account in the FM business file, then I want to delete the user account in the BF Helper file.
I’m using the onRegistration hook to check if the email exists in the FM business file. If it doesn’t exist, then I call the BF Helper CRUD api to delete the record. That doesn’t seem to be working. The user account ends up being created, and the user get’s an email to verify the address. I know the script is running because I get a modal I setup. I’m also getting an error in the BF Helper file:
Error code: -1007
errorDescription:unknown error code
info:Error calling Developer Hook - hookSetName: - 0
scriptName:BF - Common Dispatch
Not sure what I’m doing wrong or what the error is. Should I have the check and delete action in the onAuthNotifier script instead?
The process you describe in checking for the user in the onRegistration hook and deleting them from the helper file if you don’t want them to have access is the correct workflow and it works for many of my BetterForms apps.
Can you post the code of how you are calling that User CRUD API script? Have you stepped through that in the local script debugger to see why it might not be deleting the user record?
Thank’s Eluce. It looks like it’s a permission issue. The standard setup for the BetterForms user limits it to just XML and the data API. Would there be any security issues (or other issues) with opening up fmapp extended privilege for the user ID?
I’ve got the delete BF user ID process working (permission issues and the delete flag actually isn’t a boolean, it’s a string). But, the verification email is still being sent. Is the only way to prevent this to put another check in the authNotifier script?
I will have Jason check that flag typing,
You should not need to change the BetterForms account privs, it sounds like you are needing to call the CRUD from bf client?
You don’t need to allow the BetterForms user access outside of XML or the DataAPI because that’s how all calls from your BetterForms site come in to your server. When you are testing your system locally, it’s a good practice to use a different user account so that you have access via the FileMaker client.
Sorry for the delay, been on back to back client calls all day.
@eluce You were right, I took off the fmapp privilege set, and it appears to be deleting the user ID. I am still getting a verification email. How do I stop that process? The link doesn’t do anything, but I’d rather the email not be sent.
onAuthNotifier scripts run simultaneously, so you would have to perform the same check in the
onAuthNotifier script to prevent the email from sending.