I have built an amazing app (runs on a fmp server) we're I run 6 fmp files (4 host of databases) and 2 fmp file with the interface, scripts and logic.
My issue is that I need to add each user in all 6 fmp files manually, I want to make a script that creates all users at once on all fmp files. I tried using the fmp url but I can't get this this to work (with my current solution it cant be run in web, all has to be done inside fm and also work in webdirect)
Another way to solve this would be that auto login to external databases with same user for all users.
I think you are right, @Torsten. But server group accounts one creates only once in a while. These to create manually in each file should not be too time wasting. And normally you have only a handfull of these.
Without reading the blog from @mipiano, which I suspect will be similar, we create our own Human Resources/Account Management module, which allows us to setup user accounts with a group and temporary password (to change on first login) within a standard FileMaker record. The script then adds, removes, or changes password as desired in the UI file and calls scripts in each of the other files by passing the 3 essential credentials via JSON parameters and sets the accounts up.
This of course could loop through records that have been setup for multiple users and set all users up within a single routine.
Can you drop an example how you call a script from file A to file B with JSON.
@jojolito , look at the script "Add User - Save" in the demo file that you could download from the linked article above. There are script calls with json parameters. You can specify a script from an other file (data source).
@mipiano has provided the info, I'm not sure if you have all what you need, but just in case:
A script in one file can call a script in another by selecting the other file from the drop down that normally says "Current File (FileName)" and adds that file as a data source.
After that, you can exchange parameters exactly as you can between scripts in the same file. Hence, sending JSON as per @mipiano has suggested works fine when you use Get ( ScriptParameter ) in the called script.
All you need to do is ensure the additional files have the same privilege sets as the UI file and can then use If(), Else If() to match the privilege and then have the 'Add Account', 'Delete Account', 'Enable Account' and 'Reset Account Password' script steps in the appropriate scripts.
I suggest you set all the scripts to 'Grant Full Access Privileges' to ensure users with access to the layout that will trigger this can run the routine, regardless of how their account privileges have been setup.
Why shouldn't it? When I look into the script and choose to display which functions work in webdirect, none of the account managing functions is greyed out.
Also you can use WebHook functions to define your own way to trigger URLs on the target computer, so you can query a script on another computer (or same).
Hello @jojolito ,
now I found the time to test it with webdirect. It works fine. You just need to enable webdirect access in each file you want to manage the users with.
It has fatal errors (meaning you have to crash FileMaker) if you are trying to create an account which already exists in one of the files and the management of account deletion doesn't fair well if the account has been given full access privileges in some of the file: won't get deleted in those but the list of the accounts in the manage accounts layout will not reflect that.
@Cecile
This solution works - as it is - only if the users managed with it have the same privilege sets in all files. If you need exceptions, you have to consider this in the scripts. In addition, full access accounts should not be managed with this solution - if only for security reasons.