how to copy a property value of type "password2" value from global scope to private scope?

ramireddy
Mega Guru

Hi,

We have a property of type "password2" in our previous version of application, which is built in global scope. Now, we are creating private scoped app. So, while migrating this property value, I am getting "null" value. what is the workaround for this?

In a scheduled job, i have following 2 lines of code. While URL is returning correctly, "password2" property is not returning correctly and null value is returning.

gs.info("Url:" + gs.getProperty("com.url"));

  gs.info("Secret:" + gs.getProperty("com.secret"));

1 ACCEPTED SOLUTION

Thank you for the clarification.



As you may have already found out, the gs.setProperty() method is not available in scoped apps. However, you might be able to do this with a Fix Script. I believe those run in the global scope. I'd have to double check. The Fix Script will run when the scoped app is installed (using the publish/install method, not update sets.)



Give it a try and let me know.



Fix Scripts - ServiceNow Wiki


View solution in original post

9 REPLIES 9

Chuck Tomasi
Tera Patron

Hi Ram,



Can you provide some clarification? How did you attempt to migrate the property to your scoped app?



Is the code snippet trying to access your old properties or your new ones? If they are the new ones, use the full name in the name field, not just the suffix.) It should have the scope prefix (e.x. x_snc_appname.property.name for property.name in that scope)


Hi Chuck,



Yes, I am using full name. For "editing" purpose, I removed some part of property names. Through a scheduled job in "scoped app", I am trying to copy global properties values to scoped app tables.



gs.info("Url:" + gs.getProperty("com.companyname.category.url"));  


gs.info("Secret:" + gs.getProperty("com.companyname.category.secret"));



Thanks


Rami Reddy


I recommend copying the properties manually via sys_properties. Go to the list, locate your old property with the old value, copy the value, switch app scopes, create a new property with new suffix, description, type, and paste in the value.




Once copied, the values are available to your scripts with the gs.getProperty() call


Hi Chuck,



We have an global application, which is already used by customers. Now, we are changing this app to "Private scope". To help customers, we are thinking of providing a migration script, which will copy global application to scoped application. I am able to copy everything including Properties,Tables data. However, I am not able to copy "Password2 property" value alone.



I guess asking customers to copy manually is not appropriate. Is there any alternative solution?