Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business Continuity Management RTO Gap Calculation

chaluisant
Tera Expert

We are in the process of deploying BCM.  Trying to understand how RTO Gaps are calculated.  I have created sample BIA and completed the RTO Impact  and Dependency Assessments.  I also have a Plan with a defined Scope, Loss Scenario and completed the Asset Dependencies and Recovery Strategies.  Can't get the RTO Gap Workspace section to populate:

 

find_real_file.png

Thanks in advance for your help

3 REPLIES 3

Robert Bubala
Kilo Contributor

Good morning, I am also interested in this process.  Have you learned anything on your question since you posted it?

Thank you.

chaluisant
Tera Expert

Hi Robert,

 

Yes.  There is a Business Rule in the sn_bcp_plan_asset table called GetRTOGapDuration which controls the calculation of the gap.  It requires both the recovery_time_objective and recovery_time_achievable fields for each plan asset to have data:

 

find_real_file.png

 

Here is the BR:

 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var recoveryTimeObjectiveString = current.recovery_time_objective.starts_at;
	var recoveryTimeAchievableString = current.recovery_time_achievable.starts_at;
	
	var isRtoGapUnobtainable = !recoveryTimeObjectiveString || !recoveryTimeAchievableString;
	
	if (isRtoGapUnobtainable) {
		current.recovery_time_objective_gap = '';
		return;
	}
	
	var recoveryTimeObjectiveDateTime = new GlideDateTime(recoveryTimeObjectiveString);
	var recoveryTimeAchievableDateTime = new GlideDateTime(recoveryTimeAchievableString);
	var isRtoGapPresent = recoveryTimeObjectiveDateTime.compareTo(recoveryTimeAchievableDateTime) === -1;
	var rtoGap;

	if (isRtoGapPresent) {
		rtoGap = new GlideDuration(recoveryTimeAchievableDateTime.getNumericValue() - recoveryTimeObjectiveDateTime.getNumericValue());
	}
	else {
		rtoGap = new GlideDuration(0);
	}
	
	current.recovery_time_objective_gap = rtoGap;

})(current, previous);

 

The calculations are now working for me:

 

find_real_file.png

Yordan Staykov
Tera Contributor

Hey, does anyone know where this Recovery Time Achievable fields gets populated by? Is it calculated by a rule, or it needs to be manually populated?