[ColdBox 3.6.0] Returning Json of ORM object updated

I need to make an ajax request (I’m working with angularJs) to my rest api to update a record.

I have this code:

property name=“dashboardService” inject=“entityService:Dashboard”;

// PUT REST request
function update(event,rc,prc){
rc = event.getCollection();
rc.req = toString(getHttpRequestData().content);

if (isJSON(rc.req)){
obj = deserializeJSON(rc.req);
transaction{
local.dashboard = dashboardService.get(obj.id);
dashboard.setName(obj.name);
dashboard.setLayout(“test”);
dashboard.setUpdated_at(Now());
populateModel(model=local.dashboard, exclude=“id”);
dashboardService.save(local.dashboard);
//ormFlush();
}
}
event.renderData(data=local.dashboard, type=“json”);
}

I’m trying to update my model, save to database and outputting a json string of just saved record.

This seems to work well, but sometimes I got error:

Application Execution ExceptionError Type: expression : 0

**Error Messages:**key [DASHBOARDBEAN] doesn’t exist in struct (keys:)

ID: ??
LINE: 97
Template: E:\wamp\www\angular\handlers\api\Dashboards.cfc
ID: ??
LINE: 756
Template: E:\wamp\www\angular\coldbox\system\web\Controller.cfc
ID: ??
LINE: 640
Template: E:\wamp\www\angular\coldbox\system\web\Controller.cfc
ID: ??
LINE: 236
Template: E:\wamp\www\angular\coldbox\system\Coldbox.cfc
ID: ??
LINE: 62
Template: E:\wamp\www\angular\Application.cfc
Framework Snapshot
Current Event: api.dashboards.update

My guess is that you have null data for the column in your database.

Not null data in the column. If I try the ajax script it randomly get executed or get error. The data I grab from database are always the same.