Call Templates - Using call parameters in a call template export

Currently I am working on a small test component that does SOAP calls based on a Call Template similar to ‘Novulo Purchasing through call templates - 10069’.

As part of developing I am testing with Call Templates. I configured a Call Template and added an export definition (that returns the same record every time) for the request and an import definition to process the response. Everything seems to be working (for my static test case).

In the end I don’t want the export definition to return the same record every time but return a specific record based on the record from which the call is made. Based on what I see in ‘Novulo Purchasing through call templates - 10069’ I think I can achieve this by putting the record for which I do the call in the parameters of the ‘N_Call Template Build, Execute, Process’ process component I use in the component (so I did).

But how can I use the record (in the parameters) in the related export definition that I configured in the Call Template?

In the export definitions I see the option to add parameters but it is not clear to me how I can use those in relation to the parameters of the ‘N_Call Template Build, Execute, Process’ process.

Thanks in advance for your reply!

Hey Geert Jan!

I understand the problem that with every call, you want to send data based on a different context. There are several solutions to this problem. The one below is the most straightforward:

Using the ‘parameters’ parameter

The process ‘N_Call Template Build, Execute, Process’ has a parameter called ‘parameters’ of type ‘List<Tuple<String,Mixed>>’.
You can pass as many context records/data as you want. When the process reaches the default building step, then those parameters will be passed down to the process that uses the export definition/data definition to build the XML/JSON body of the call.
This happens by default if you set an export definition (or a data definition) at the call template:

Make sure that the linked export definition uses parameters (1) and that you defined some parameters. In my case, I set a parameter ‘prompt’ of type ‘string’. But you can really use any kind of parameter.

After adding a parameter, make sure that it is also used as a placeholder within the export definition. In my case, I put ‘%prompt’ in a field. Then i used an XSLT to get the following body: {“model”: “gpt-3.5-turbo”, “messages”: [{“role”: “user”, “content”: “%prompt”}]}.

To try out if everything works, you can use the test panel on the call collection page. Tuple lists have the following format " [ <“key1”,“value1”>,<“key2”,“value2”> ]"

In my case, I got this beautiful response:

Linking context records to a call

As an addition it is also possible to link the call record to a Novulo record and then only pass the current N_Call record to the export definition. For example, before building a call, you can set a field at the call and link it to an N_Purchase record with a process that you build. So, for example, call with ID 1 would be linked to purchase with ID 123. See M10069 ‘N_Call - Ensure purchase at call’ for example.
image

Then, only the parameter “call” can be passed to the export definition. Within the export definition, you can then access the purchase record via “%call.purchase”.
The advantage of this approach is that you can add the purchase field as a column in grids and that you can use it for filtering. If for example you executed multiple calls for purchase 123 you can add a list of all calls for a specific purchase to the purchase page.

Furthermore, when the process ‘N_Response - Process’ is executed, the purchase record can be accessed as well via ‘trigger.response.call.purchase’ to make changes to it. For example, one could update a status to ‘has been sent successfully’ or to ‘retry sending’ depending on the response.
If you want to process your received data similarly, let me know! In this case, I would like you to use ‘M10388 - Novulo Call template processes’ so that you can execute custom processes before/after building/processing calls.

Hi Joachim,

thank you for your thorough explanation!
Based on your example I managed to get the result I was looking for, thanks!

Geertjan

1 Like