The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Lisa Latour
Administrator
Administrator
Having too many developers or projects in your instance where there is constant clash between developers?   Then scoped application development might be your answer.   This white paper helps you understand all about application scope, when to use to it and best practices for it.   

This article was created for customers who are interested in understanding Application Scope (to be referred to as scoped apps in this article). It is intended to provide an overview of when to use scoped apps, where to use them, and best practices.

When we talk about application building in this article, we are referring to extending or modifying existing applications like Incident Management, Problem Management, or custom applications that can be built from scratch. This article does not show you how to build apps in ServiceNow. Prior knowledge of what is a ServiceNow app and how to build them is necessary.

A video link provided at the end of this article will show you a step-by-step process of how to create a scoped app.

Application Development on the Now Platform

Application development on the Now Platform allows you to develop solutions to solve common business problems such as automating manual processes that are generally tracked with spreadsheets and emails. Traditionally, applications built on ServiceNow use workflow to process information. Configurable properties like approvals, SLA's, and various kinds of notifications can be added to a workflow to make an application complete. Since applications built on ServiceNow may require data from your external applications, there are many API's available "out-of-the-box" for rapid integration.   Customers with professional development resources can also create their own scripted API's for integration.

The Now Platform is very versatile and allows you to create solutions whether you are new to programming or a professional developer.   If you are new to application development and do not have any programming experience, then it's possible to create simple applications which do not require any coding. A common "no-code" example is automating spreadsheets (that track the status and data of common business processes). Applications can be built on the Now Platform by creating new tables (custom) and/or by extending existing tables to create new tables. When creating new tables to build an application you can use the default form layout for populating data in the table or modify them to create your own form.   If need be, existing applications can be taken and modified to create new applications.

What are scoped apps and why do we need them?

There are two types of available application scopes: private application scope (commonly referred to as scoped apps) and global scope. Each ServiceNow application has an application scope that determines which of its resources are available to other parts of the system. Application scoping ensures that one application does not impact another application. You can specify what parts of the application other applications can access by setting application access settings. But let's start with private application scope, or scoped apps. We will refer to private application scope as scoped apps for the rest of this article.

scoped-apps-1.png

When you start building applications in ServiceNow, there are times where Developer 1 can easily modify another application's artifact without knowing what Developer 2's code they may be "stepping on."   In order to avoid that, application scopes have been introduced. If an application is built as a scoped application then other applications cannot access the data or code of this scoped app, unless otherwise explicit permissions have been given. Let's take a common example, a conference room booking app. In this example, the scoped app stores all the information about conference rooms (such as location, schedule, etc.). If another ServiceNow application attempts to access the functionality (business logic) or data of the conference room booking app, it would be denied access. Access can only be granted if explicit read/write permission is given to the other application.

How do you create scoped apps on the Now Platform?   Is a scoped app suited only for specific types of applications? What is global scope?

Creating scoped apps on the Now Platform is very simple.   Most developers use the Studio IDE (Figure 1 and Figure 2) to create a scoped app. Once the scope is created, developers can be assigned (Figure 3) permission to develop under the scope using delegated development. Any person with a system administrator role, can develop in the scope. There are no restrictions as to what type of application needs to be built as a scoped app.

scoped-apps-fig-1.png

Figure 1

  scoped-apps-fig-2.png

Figure 2

  scoped-apps-fig-3.png

Figure 3

Applications in the global scope are like shared resources that any application developer can modify. Application scopes were introduced in the Fuji release of ServiceNow back in March 2015. Global scope applications do not have a unique namespace identifier included in their application artifact names, but they can have their own application access permissions. Typically, only applications provided by ServiceNow are in the global scope, however all custom applications created before application scope was implemented are also in the global scope.

Any app that can be built under global scope can be built as a scoped app. But, there are certain basic principles that need to be understood before a scoped app is built. If global scope files need to be used, then they need to be copied into the scoped app or the artifact should be marked as "Accessible from all application scopes". To start building a scoped app, you need to have an admin role in the instance where you are going to develop the application and the admin needs to create a scoped app container. After that, the scoped app can be built in the container.

When should you build an app under global scope versus private application scope?

There are two use cases when considering application scope: extending an existing app or creating a custom app from scratch. If you are extending or modifying an existing global scope application and the changes are having a high impact on other applications, then leave the change in the global scope. However, if the changes are going to have less impact to other applications, then the modifications can be done as a scoped app.

When you are creating a new application from scratch, you should be creating it as a scoped app. ServiceNow's product strategy is to develop more and more scoped apps to make it easier for customers to deploy the application and to simplify future upgrades. Also, backing out changes to scoped apps is much simpler and can be done with a single push of a button.

What application functionality works under a scoped app?

All Now Platform core services (such as workflow, business rules, and UI policies) that are available in a global scope are also available in a scoped app. Global artifacts like tables and scripts that are marked as accessible from a global scope are available in a scoped app. However, there are a few out-of-the-box APIs that do not work currently in a scoped app. As more and more APIs are being made available in each ServiceNow release, please keep checking the link to the API list provided below before you start using any out-of-the-box APIs in a scoped app.

Can we move apps between global and scoped app?

Once you create an app in global scope or as a scoped app, moving from one to another is not recommended. There is no tool available to automatically do this migration.   You may have to basically rewrite the entire app if migration is required.

Do update sets work in scoped apps and do they work the same as global scope?

Update sets work in scoped apps just like they do in global scope. But there is a better way to move scoped apps from one instance to another. This capability is called "publish" and it allows you to move an application just like you would with a single executable. The publish capability checks for dependencies and locks the application in the instance where it has been moved so that no changes can be made.   If you need to back out the changes, it is easy to uninstall the current version and re-install the prior version.   But you need to be careful if you have made any data changes as you may lose them when you back those changes out.  

With update sets, backing out of changes is tedious since you need to back out each update set separately. For example, if you have update sets 1 through 10, then you need to back out these updates in reverse sequence.

What are some challenges and mitigations I should consider when working with scoped apps?

When you need an artifact such as a business rule or UI policy from a global scope, you have to replicate that in your scoped app to make it part of a script include (Figure 4).   In order to access a function or an artifact referenced in the wrapper script, it should be referenced as appscope.scriptinclude.function. If the wrapper script is defined in a scoped app, then the function or artifact will be available only to that scope and not outside of it. This poses a couple of challenges. One, there may not be any documentation regarding encapsulation of wrapper script unless you explicitly document it.   Second, when making changes to these global artifacts, you need to consider any scoped apps that are impacted. Without proper documentation, you might miss these during your analysis.

scoped-apps-fig-4.png

Figure 4

What are some best practices for scoped apps?

  1. Always create new applications as a scoped app.
  2. When extending a global app, if there are going to be frequent changes to the application or if there are many modifications to the global artifacts, extend the application in global scope.    
  3. If you need to use a global scope artifact in a scoped app, you need to copy the artifact in the scoped app or wrap it with a script include.
  4. Always document the changes you make to the scripts or artifacts of your applications for easier analysis during the upgrade process.
  5. If you are planning to use an API in a scoped app, check out the link given at the end of this article to see what API's are available.
  6. When moving scoped apps from one instance to another, use the publish function to deploy rather than using update sets.
  7. Do not try to move applications from a global scope to a scoped app and vice versa, since there is no direct migration or tools. You have to manually create the new artifacts.

Link to list of API's that work and don't work


https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=server

Video about scoped applications

Comments
Matt Hernandez
Tera Guru

The evernote video link is not accessible.


shivaramachandr
ServiceNow Employee
ServiceNow Employee

Hi Matt



Thanks for the information.   Will look into it



Shiva


Lisa Latour
Administrator
Administrator

Hello - I believe we've been able to embed the video to replace this error


shivaramachandr
ServiceNow Employee
ServiceNow Employee

Thank you Lisa.  



Matt



Can you please check it now?



Thanks



Shiva


Matt Hernandez
Tera Guru

It works now, only it must play small..it can't expand and the full screen option is disabled. So its viewable, but not completely user friendly. Of course there is a share link that can be copied and opened manually if needed. Much better, just not ideal.



fullscreen_unavailable.png


patricklatella
Kilo Sage

Thanks Lisa for the post.



I have a question.   I'm using the System Applications>Applications module to use the "Make App available on other instances" method of migrating a scoped app to our TEST environment.   After the initial migration of the application, when using this method to migrate updated versions of the application, the new version of the application in TEST is not a mirror image of the application in DEV, like it would be if update sets were used.   Specifically the list of ACLs configured in the scoped app does not match.   And another edit that did not transfer was the default list view of records on the scoped app tables. (view from the scoped app's modules, which are "List of records").



Is this expected behavior?   In some cases is it actually necessary to use update sets to move updates to a scoped app?



thanks!


shrity
ServiceNow Employee
ServiceNow Employee

Patrick,



Any deletes doesn't gets propagated using App repo.   If that's what you are experiencing then it's behaving as designed.



Thanks


Shrity


MauricioMachado
ServiceNow Employee
ServiceNow Employee

Is it possible to have "partial sysadmin" for a scoped application? with some restricted   access and rights?


shrity
ServiceNow Employee
ServiceNow Employee

What are the access you are willing to give to this partial sysadmin ? Some of the permissions can be granted   by delegated development or application administration feature.



Thanks


Shrity


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Patrick,

 

Shrity is right here. Please refer below blog for more info on how the deletion behaves in a scoped app.

https://community.servicenow.com/community?id=community_blog&sys_id=29ace225dbd0dbc01dcaf3231f961953

 

Thanks,

Pradeep Sharma

Daniel Draes
ServiceNow Employee
ServiceNow Employee

Wanted to share a bit of thought on this one... 🙂 Scoped applications are a good technology but have some caveats in terms of usage.

Best Practice 2: extending global apps

We extended the ITSM suite at one customer into a private scope. And the reasons for this are good - just as you mention: control of what is / has been changed. It turned out though that a lot of objects had to be deactivated and copied just to work around some scope limitations. Let me give you an example:

On the incident form you want to add a UI policy hiding a global field (i.e. subcategory) based on a selection in a scoped field. This is not possible, the scoped UI policy cannot modify the visibility of a global field. When you stick to the scope-rule you are now forced to extend the full table (created a new x_scope_incident) just to allow the UI policy to work. This though causes much more issues going forward as suddenly some global scripts (Business Rules / Script Includes) do not expect an extended table for incident. So you are also forced to deactivate and copy these. A so far simple change (one UI Policy) suddenly becomes a complex thing with more than 5 global objects changed and another 5-10 custom objects created. I doubt that this is easier to maintain than the simple global UI policy.

The example might be an extreme one, and I know that we as ServiceNow spend a lot of resources to make the scoping more simple. But still, things which are global are intended global (well, mostly historic reasons), so better keep them this way.

Best Practice 3: Usage of global artifact

I would prefer the wrapper script rather than copy. Copy means you have a duplication of entries and need one more object to maintain. So whenever you can, 'just' wrap it and use it as is.

Best Practice 6: moving a scoped app (aka deploy)

I am not aligned to this one. Based on my experience it is much better and safer to deploy using the traditional update sets. The publish function was to my knowledge developed to put an application into the ServiceNow-Store. Distribution an app through the store and maintaining it at a lot of customers has some other requirements (i.e. you cannot easily delete an object as you don't know who is using it).

In addition, if a customer plans for application scopes being published, it means that the customer suddenly has two different deployment mechanism as of now (global changes cannot be published). If you have dependent objects you need to synchronise the two. Seems complicated for people to understand and navigate.

Staying with (plain old) update set technology - which is proves in millions of deployments - seems just to be the better choice as of now.

marclindsay
Mega Guru

Has any of the Best Practices mentioned above changed over the years with the current Release being Paris? 

Daniel Draes
ServiceNow Employee
ServiceNow Employee

I'd say the one changed would be Best Practice 6 - deploy using update sets. By now the default deployment method should be Application Repository. Publish your app(s) from Studio to the repository and install from there using the 'My Companys Applications' module.

 

This also extends to non-scoped applications - aka. global applications.

Daniel Draes
ServiceNow Employee
ServiceNow Employee

Seeing my old post I think it deserves an update 😄

Best Practice 6: moving a scoped app (aka deploy)

Nowaways I would not recommend anymore to use / stick with update sets. We have made great improvements on how we package applications and publish them to the application repository. This should be the no. 1 / default way to go. If you happen to have a complex environment with lots of developers and potentially lots of instances using source control as a mechnism can also be a help.

 

Jan Ujcic
Tera Contributor

Were there any recent changes in extending global apps (e.g. ITSM suite)? Is it worth dividing it into multiple globally scoped apps to better control changes?

 

We are working with packaging and publishing scoped applications (with Azure DevOps) but for global ITSM applications, we still use update sets. Are there any guidelines or plans to unify this way of working? It is complicated to keep documentation and ways of working aligned when you have two different mechanisms of deployment on the same platform.

 

 

Daniel Draes
ServiceNow Employee
ServiceNow Employee

@Jan Ujcic : Depends on what is recent for you 😄
Generally, I do recommend to use at least one global application for ITSM... depending on your setup of dev-teams it might also make sense to have multiple (i.e. Incident, Change, ...). Do not use a scoped application, this will cause problems with cross-scope access for global things. But use a global application to capture and track changes, absolutely! Also, avoid moving objects from one global app to another constantly. This can cause confusion during deployments (like deleting and recreating objects).

ACobb
Tera Contributor

In my organization, the team that manages the Now platform is requiring developers outside of their team to create scoped apps in order to create Service Catalog items.  My question is why?  Does that make sense to anyone?

Version history
Last update:
‎09-21-2017 04:28 PM
Updated by: