Action Decl Metric - "function metadata not found" Error


#1

I’m implementing an actionDecl metric is on srcType “Facility”, the Javascript function added as a method on the type. The custom function returns a Timeseries.

However, I run into this error in my localhost when i attempt to run a
_

Facility.evalMetric({expression: “PriorYearElectricityAverageBenchmark”, id: “res_facility_1”, start: “2018-01-01T00:00:00”, end: “2019-01-01T00:00:00”, interval: “MONTH”})

_

Error:

Failed to evaluate customJSMetric. function metadata was not found for action Target [customer/prod/Facility?action=priorYearElectricityAverageAndEfficientBenchmarking],srcId=res_facility_1,srcType=Facility,metric=PriorYearElectricityAverageBenchmark,start=2018-01-01T00:00:00.000,end=2019-01-01T00:00:00.000

Any help / advice would be appreciated!


#2

Need to provision your changes and refreshed the console to re-import the new definition of type Facility


#3

I tried refreshing the console, and was able to verify the new definition / additional methods on the type Facility, but unfortunately get the same error.


#4

can you post your metric definition and the signature of your function?
Here is a typical implementation of actionDecl Implement a metric as rollup metric


#5

With the help of platform team, I was able to resolve the issue.

The errors were two-fold;

  1. a misnamed function,
  2. Making sure the parameters, esp the obj: !Obj one, were correct. I originally had facility: !Facility.