The Telerik Platform product is retired.Learn more

How to Determine the Id of the Requested Data Item in Business Logic


Service Business Logic
Feature Cloud Code for Data

Applicable only to Cloud Code for Data.


Often you may need to determine when data is accessed by item Id (and respectively the Id of the requested item). This may be helpful in cases when you would like to apply different business logic for data operations per Id and operations that are accessing or filtering all data items. For example, you may deny Delete requests that are not per Id. This check is applicable to Read, Update and Delete requests and their respective events in the Cloud Code for Data.


You can get the Id of the item from the request parameters but only if the request is made by Id as opposed to requests by filter (or to all items).


if (request.itemId) {
    // data is accessed per item Id
    // access the item Id 
    var requestedItemId = request.itemId;
} else {
    // the request is accessing all items or supplying a filter

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.