[OPENIDM-9902] Backport OPENIDM-9217: Do not execute managed property's onRetrieve when returnByDefault is false Created: 29/Dec/17  Updated: 23/Feb/18  Resolved: 09/Feb/18

Status: Closed
Project: OpenIDM
Component/s: Module - Core mapping, synchronization, reconciliation
Affects Version/s: OpenIDM 4.5.0, OpenIDM 5.0.0, OpenIDM 6.0.0
Fix Version/s: OpenIDM

Type: Bug Priority: Major
Reporter: Mark Offutt Assignee: Mark Offutt
Resolution: Fixed Votes: 0
Labels: Sustaining
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is a backport of OPENIDM-9217 Do not execute managed property's onR... Closed
Target Version/s:
Verified Version/s:
QA Assignee: Jakub Janoska
Support Ticket IDs:



Defining a virtual attribute in a managed object, with an onRetrieve script, and for which returnByDefault is false, the script is always invoked regardless the property is requested or not. This is a performance bottleneck when the script has poor performances, which is wasted since the value is not returned into the response.

[ Note this is entered as a bug, but it could be arguably an RFE ]

Comment by Jakub Janoska [ 23/Feb/18 ]

 Verified on OpenIDM version "" (revision: 608d658) jenkins-OpenIDM - 5.0.x - Release-18 sustaining/5.0.x.

Steps for verification:

  1. ./startup.sh -p samples/sample1
  2. create test.js in openidm/scripts
    • var response = openidm.read("managed/user/bjensen", null, ["mail", "givenName"]);
  1. update managed.json
    • "city" : {
        "description" : "",
        "title" : "City",
        "viewable" : true,
        "searchable" : false,
        "userEditable" : true,
        "policies" : [ ],
        "returnByDefault" : false,
        "type" : "string",
        "isVirtual" : true,
        "onRetrieve" : {
          "type" : "text/javascript",
          "globals" : { },
          "source" : "logger.info('City is retrieved');"
  1. reconcile
  2. curl -X POST 'http://localhost:8080/openidm/script?_action=eval' -H 'cache-control: no-cache' -H 'content-type: application/json' -H 'x-openidm-password: openidm-admin' -H 'x-openidm-username: openidm-admin' -d '{
    "type": "text/javascript",
    "file": "script/test.js"
    }' | jq .


  3. Result: "*INFO: City is retrieved" is not added into log, when returnByDefault is false. When test.js returns also city attribute, "*INFO: City is retrieved" is added into log.
Generated at Tue Mar 19 05:35:29 GMT 2019 using Jira 7.13.0#713000-sha1:fbf406879436de2f3fb1cfa09c7fa556fb79615a.