We have a development SharePoint 2016 onprem environment that points to a development SQL Server database server. When we move our code to Production we do not want to have to modify the Nintex forms to change the name of the database server. Is there a way to have a database alias so that we can have dynamic coding based upon the SharePoint environment?
Add the following formula (modified to suit your environment) to the server name field in the SQL request control.
fn-If(fn-contains(Site URL,"ProdSite Name"),"ProdServer","DevSever")
Tested and it works.
fn-If(fn-contains(Site URL,"ProdSite Name"),"ProdServer","DevSever")
Tested and it works.
+3
thanks, I just did a quick test and it did not work. is the syntax correct below? Also assuming the function is an if/else ?
fn-If(fn-contains(Site URL,"http://www.google.com"),"proddbdb1","devdbdb1")
fn-If(fn-contains(Site URL,"http://www.google.com"),"proddbdb1","devdbdb1")
Looks correct.
What happens if you cut it down a bit.
fn-If(fn-contains(Site URL,"google"),"proddbdb1","devdbdb1")
Test in a calaculated value control to make sure the formula is working.
+3
Silly me, I was trying to test this via "Test Connection". After publishing the form and trying it, it looks like this works!
More tests tomorrow with my team.
I'll update the post to confirm, thank you @SimonMuntz !
More tests tomorrow with my team.
I'll update the post to confirm, thank you @SimonMuntz !
+3
@SimonMuntz we have fully tested this and it does work.
However after further discussions with the team we were able to find a better approach. We are using a Nintex constant that contains the database name. We will use the name of the Nintex constant in the SQL Request control. This gives us more options in case we ever need to change the SQL Server to another instance and allows us to make the change in one location that will reflect all forms.
Thank you for your help!
However after further discussions with the team we were able to find a better approach. We are using a Nintex constant that contains the database name. We will use the name of the Nintex constant in the SQL Request control. This gives us more options in case we ever need to change the SQL Server to another instance and allows us to make the change in one location that will reflect all forms.
Thank you for your help!
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.