Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Unallocated licenses calculation for Software Counters may sometimes get out of sync - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Unallocated licenses calculation for Software Counters may sometimes get out of sync
KB0676094

Unallocated licenses calculation for Software Counters may sometimes get out of sync


752 Views Last updated : Apr 29, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

Issue


Software Counters can sometimes show incorrect values due to corruption in the SAM cache. 

Solution


There is a manual fix where you can go to an affected Software Counter, and on that page, there is a UI Action called 'Count licenses':
 
https://docs.servicenow.com/csh?topicname=t_CreateASoftwareCounter.html&version=latest. 
 
If you click that, a script include will be triggered which will force a recount of the licenses. 
 
If 'Count licenses' fails to fix the issue, there is also a second option which will completely rebuild the SAM cache for the chosen Software Counter (also see screenshot), if the suggestion above does not fix it, rebuild the SAM cache and do a recount to see if the numbers now match up:
 
https://docs.servicenow.com/csh?topicname=t_ScheduleASoftwareCount.html&version=latest
 
In instances with many hundreds or thousands of Software counters, it may preferable to run a script to trigger a rebuild of the SAM cache for each software counter. Run the below background script out of hours to minimize any performance impact. To run a background script, navigate to "Scripts - Background" into the left hand application search field, then paste in the below script, and choose run. 
 
 
-------------------------------
var gr = new GlideRecord('sam_sw_counter'); 
gr.query(); 
while (gr.next()) { 
gr.cached = false; 
gr.update(); 
 
var script = 'var SAMCounter = new SncSAMCounter();SAMCounter.doSingleCounter("'+gr.sys_id.toString()+'");'; 
var sched = new ScheduleOnce(); 
sched.script = script; 
sched.setTime(gs.nowNoTZ()); 
sched.setLabel('SAM:' + gr.name); 
sched.schedule(); 
}
-------------------------------
 
You can then go and check all Scheduled Jobs running beginning with the name "SAM:": https://<INSTANCE_NAME>.service-now.com/sys_trigger_list.do?sysparm_query=nameSTARTSWITHSAM%3A
 
At first you'll see many jobs created, but they will be processed quickly and will disappear from your view upon subsequent page refreshes.
 
You will also notice that each software counter will have a count in progress message at the top of the page. 
 
After this, all software counters should be updated. 

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.