Insert additonal table records on user register


#1

I want to insert additional records into a table when a user registers with dreamfactory. I have attached a script to the ‘user.register.post.post_process’ event, but no matter what I do I cannot insert anything or figure out the user’s id. How do I do this?


#2

The role needs to have permission to insert into the table. You may want to confirm that first. You may be able to get some info from the dreamfactory.log file too if it’s a permissions issue


#3

Which role? After the user is registered, in this post_process event, will it be logged in as that user and thus his role? or will it still be ‘anonymous’ role? How do I get the ID of the newly created user record?


#4

user register is an anonymous call (one of the few allowed in DF.)
You’ll need to include authentication in your script, such as with an API key that has a default Role.


#5

When you created the application you would have assigned a default role to it. Now that role should have the rights to insert data into the(that) table. Have a look at the app settings and see what role it uses, and then look under the “Access” tab of that role to see what it is allowed to do. If there are more CRUD ops that you want it to do, then set the Access rights accordingly.

I am just displaying an example of javascript addresbook application available in the example apps


Cheers,
M&M