Request custom function - can it change request?

Request custom function - can it change request?

I am trying to do lifecycle query preprocessing using a "request custom function":
I receive a request through the "get" ( positionJson = requestObj.get("item"); ).
I process and do "put" ( positionJson.put(positionJson); ).
If I repeat now "get" - data is correctly.
But the request in DB not changed!
In general, is it possible to modify a query in a database using a function or not?
If it can, what else I needs to be done?

PS I try use next function:

deviceJson = requestObj.get("udf_fields");
device = deviceJson.get("udf_pick_35");
device = device.getPrefix(" ");
positionJson = requestObj.get("item"); 
position = positionJson.get("name");
iditem = positionJson.get("id");
if ( device == "mask" ) 
{
      positionJson = "{name:NewValue}";
      positionJson = positionJson.toMap();
      position = positionJson.get("name");
      positionJson.put("id",iditem); 
      requestObj.put("item",positionJson);
      positionJson = requestObj.get("item");
      requestObj.update("item",positionJson) ;
      positionJson = requestObj.get("item");
      }
info requestObj ;// correct, modified data is returned
returnObj = Collection();
returnObj.insert("result":"success","  positionJson=":positionJson);
return returnObj;