Can I pass a variable in a server connect to a library API? How?

Hi

I want to be able to exec a library server connect action (a query) and I want to pass a variable to the library action when placed in a server connect flow

Example:

  • Server connect insert a user comment.
  • Id is created and I want to grab that ID and pass it to the library action
  • This is a library action query which needs the previous id to search.

How do I do this?

Many thanks!

1 Like

You need to define a library item and define a parameter under $_PARAM. Use this parameter in the library action query to filter your data.

Then in your server action, call the library item as Exec (you can pass param to exec) and use the ID of the insert step as a value for the param you defined.

1 Like

Thanks Teodor.

I have not used $_PARAM until now. Is there any documentation or explanation as to when and where to use the $PARAM?

Thanks!

Not sure if there is document with respect to when & where… but from my experience, data passing between server side things is via $_PARAM. And for client-server - we have the regular $_GET & $_POST.

For eg: When using a server side action on a page, the query params of the URL can be accessed via $_PARAM (instead of $_GET).
Passing any data to library, also done via $_PARAM.
Passing some values from a Server Connect on client side to Server Action - $_GET.

1 Like

This tutorial covers library actions and passing parameters etc.

2 Likes