Scope name application part length?

RichGK1
Mega Expert

I'm working through the developer learning plan and have come across the following in the NeedIt training.

The scope value is set automatically by ServiceNow whenever an application is created in Studio. The scope is constructed by concatenating 3 values:

  1. x_
  2. <value from the glide.appcreator.company.code system property>_
  3. <first_10_characters_of_app_name>

Then the example given is x_27266_hello_worl

However in the documentation at the following link

https://developer.servicenow.com/app.do#!/document/content/app_store_doc_contextual_development_envi...

it states

"The application id" - "This string can be 40 characters long"

Can someone tell me which of these is correct as it's bound to appear in some form on the exam!

Thanks,
Rich

1 ACCEPTED SOLUTION

Oleg
Mega Sage

You are right: both developer.servicenow.com (https://developer.servicenow.com/app.do#!/document/content/app_store_doc_contextual_development_envi...) and docs.servicenow.com (https://docs.servicenow.com/bundle/newyork-application-development/page/build/applications/concept/c...) contain wrong information about the namespace. In reality the name of the namespace will be built based on the Scope [scope] and not based on the ID [source] of application. By the way, the length of application ID is 100 and not 40 in actual releases of ServiceNow.

Names of some objects are build as namespace + "." + suffix. Names of other objects are build as namespace + "_" + suffix. In any way, the names uses the application scope, which length is 18 characters, where you can free define only the last 10 characters during creating of your application.

When you create the application with the name "Hello World" for example, then the scope name will be generated as something like x_27266_hello_worl, but you still able to modify the last characters of the scope to, for example x_27266_helloworld. After that the object in sys_app table will be created. You can type sys_app.list in menu to display the records in sys_app table and click on your application to open it. Then you can modify the default view of the application to display the application ID together with the Scope:

find_real_file.pngfind_real_file.pngfind_real_file.png

 After that you can see application ID and modify it:

find_real_file.png

After that you can create new tables, script includes and other application files/objects. You will see that ServiceNow uses the application scope and not the application id for building the names.

Examining of different standard Business Rules like "Set name with new suffix on update", "Validate Table name and Element name" and many other shows that ServiceNow uses scope (current.sys_scope.scope.toString() for example) for building the prefix of the names and not the application ID.

View solution in original post

2 REPLIES 2

Harsh Vardhan
Giga Patron

Length of "scope" field is 18 character , so if you pass the 40 char application id it will not show all char. 

 

eg: name = communityapp 

then scope will appear as "x_43765_communitya" , total length is 18. 

 

 

Oleg
Mega Sage

You are right: both developer.servicenow.com (https://developer.servicenow.com/app.do#!/document/content/app_store_doc_contextual_development_envi...) and docs.servicenow.com (https://docs.servicenow.com/bundle/newyork-application-development/page/build/applications/concept/c...) contain wrong information about the namespace. In reality the name of the namespace will be built based on the Scope [scope] and not based on the ID [source] of application. By the way, the length of application ID is 100 and not 40 in actual releases of ServiceNow.

Names of some objects are build as namespace + "." + suffix. Names of other objects are build as namespace + "_" + suffix. In any way, the names uses the application scope, which length is 18 characters, where you can free define only the last 10 characters during creating of your application.

When you create the application with the name "Hello World" for example, then the scope name will be generated as something like x_27266_hello_worl, but you still able to modify the last characters of the scope to, for example x_27266_helloworld. After that the object in sys_app table will be created. You can type sys_app.list in menu to display the records in sys_app table and click on your application to open it. Then you can modify the default view of the application to display the application ID together with the Scope:

find_real_file.pngfind_real_file.pngfind_real_file.png

 After that you can see application ID and modify it:

find_real_file.png

After that you can create new tables, script includes and other application files/objects. You will see that ServiceNow uses the application scope and not the application id for building the names.

Examining of different standard Business Rules like "Set name with new suffix on update", "Validate Table name and Element name" and many other shows that ServiceNow uses scope (current.sys_scope.scope.toString() for example) for building the prefix of the names and not the application ID.