Control procedure effect on API

  • 25 March 2022
  • 1 reply
  • 45 views

Userlevel 1
Badge +4

Hi,

Recently I have been encountering some problems with the OData api because of some code written in the stored procedures. Up till now I noticed that the layout and default CP have effect on the api.
 

For instance: I had once written in my layout CP to set some fields on Read-Only if a certain condition is met. Turns out that these fields are also set on read-only for the api, which results in not being able to update the field via a mobile app and getting a 403 error. 
 

Now I have this piece of code (as show below) which I thought would only effect the gui because I specifically added the ‘@cursor_from_col_id’.

But now when I use the api to update a record, the status is always set to ‘RGS’ because I have a service type that is not equal to ‘OTH’. Removing the field from the request still doesn’t seem to help this issue.

How can I tackle this issue? Is there something that need to be aware of?
Thanks


1 reply

Userlevel 6
Badge +16

The default is called for each column you modify in order of entry. So if your input is column1 and column2 the default is called in this order:

default with @cursor_from_col_id = null
default with @cursor_from_col_id = column1
default with @cursor_from_col_id = column2

I assume you also update the job_status? 
If you amend both the job_service_type and job_status in the postman post then you probably want to enter the parameters in this order: job_service_type, job_status

Reply