In a previous blog I showed you how to create an object function for a business object to allow you to expose specific functionality on a specific row. This blog is a little variation on this capability showing you how to create service methods in your data layer that are not related to a specific row.
This is based on a use case a customer had where they would get data for a record in a table, if the row already exists in the table they need to update it. If it doesn't exist they need to create a new row with the data. The REST API provided by the Visual Builder business objects supports this use case as long as you have the id of the record you want to update. This is done with the upsert option for a POST call - see the information about this combined insert/update operation here.
But the data that the customer got didn't have the id of the record they would need to update. Instead they had the information about another field in the object. To resolve this we can create a function in the BO layer that will search the set of records for a specific value in a specific field, and then update that record if the value is found, or insert a record if it doesn't exist. Read the complete article here.
For regular information become a member in the Developer Partner Community please register here.