Solved

Pass message to indicium

  • 24 November 2023
  • 3 replies
  • 65 views

Userlevel 5
Badge +12

Hi, 

I have a subroutine ‘delete_project’. When I call this, it deletes the project. When a record has Referential Integrity and ‘No Action’, Indicium nicely respond with a base64 encoded message that it ‘ can’t delete due to Related <tablename>’ . So far, all good. 

However, when I don’t want to delete the project because it has for example a [status] = ‘active’ - so deleting is not allowed. In the gui we can display a message. Or with importing some data from an API, at the end we show a success/failure message; perhaps with a Process flow.  

Is it possible - and if so, how - to pass these messages through Indicium? If a user connects with the end-point, it will make a lot more sense then a 422 - unprocessable entity when something is not allowed, or processed correctly.

Thanks! 

Blommetje 

icon

Best answer by Blommetje 28 November 2023, 09:36

View original

This topic has been closed for comments

3 replies

Userlevel 2
Badge

For this you want to use the SQL RAISERROR function in your stored procedures. 

For example: 

If @status = ‘active’

begin

   raiserror()

end

If you want to know more about this function you can check https://learn.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql?view=sql-server-ver16

Userlevel 6
Badge +4

Hello Blommetje,

I would recommend using tsf_send_message, which uses raiserror, but allows you to send translated messages that are managed in the SF.

I hope this helps.

Userlevel 5
Badge +12

Yes, seems to work! Thanks!