Check out the blog from Derek Albaugh about the issue with missing security roles and tasks after upgrading to GP 2016 R2. You can find the information at https://community.dynamics.com/gp/b/dynamicsgp/archive/2016/10/14/new-security-roles-and-tasks-are-missing-when-upgrading-to-microsoft-dynamics-gp-2016-r2-and-year-end-update.
Some of the critical information about the scripts required is noted below, from Albaugh’s blog.
These scripts for Microsoft Dynamics GP 2016 / Microsoft Dynamics GP 2016 R2 missing security roles and security tasks records can be found here, and needs to be run against your DYNAMICS/security database:
This set of scripts includes the security scripts for Microsoft Dynamics GP 2013 R2, Microsoft Dynamics GP 2015, Microsoft Dynamics GP 2015 R2 from prior blogs, as well as Microsoft Dynamics GP 2016. You’ll need to run this script whether you’re upgrading from Microsoft Dynamics GP 2013 R2 or Microsoft Dynamics GP 2015/R2 to Microsoft Dynamics GP 2016/R2.
**NOTE: Because we’ve combined the INSERT scripts from the other blogs to be included in this one, you may see PRIMARY KEY errors referencing duplicated records trying to be inserted into the security tables. This can be ignored as it means that the record already exists in that table and the script will not overwrite anything that is already present.