Solved

XML Maps - Integration function result


Userlevel 2
Badge +6

Hi, 

We are creating an incoming message to Create or Update a Task. In this incoming message we will also create/update one or several task text entries related to the task.

Our requirement regarding Task Text, is that for a specific task we can only have one task text per text_line_code. 
Example: For task with task_id = 100 we can have 2 task texts one with text_line_code = TYPE1 and other with text_line_code = TYPE2, but we can not have two task texts entries with text_line code = TYPE1.

To meet this requirement we have created a integration map function to do the validations, Before mapping (we will save from this function information for fields: text_line_code, text and text_sequence). The function is working correctly when we are creating/updating only one task_text. However when sending two task_texts, the function runs two times, but it only saves the result of the second time it runs, meaning that both task text entries will have the same information(text_line_code and text).

Does anyone knows if it is possible to solve this issue? The goal is to save the result of the integration function per each task text.

Thanks for the help, 
Kind regards,
Joana Machado

icon

Best answer by Saranga Amaraweera 3 May 2022, 16:24

View original

7 replies

Userlevel 7
Badge +22

Hi @joana.m.machado 

Could you please share the relation definition tab/ the mapping  tab and the process tab in your xml map?

Userlevel 2
Badge +6

Hi!

 

Here is the relation definition tab:

 

  • Mapping: 
  • Processes Tab:

Thanks :) 

Joana Machado

Userlevel 7
Badge +22

Hi @joana.m.machado ,

Can you change the execution point with On Mapping and try the same out? Also could you share the integration function too, if possible?

Userlevel 2
Badge +6

Hi @Saranga Amaraweera , yes we have already tried On Mapping and it does not work. 

Here is the function:

This function is working, the only problem is when we have to handle two task_texts in the message, both will be created or updated with the information that results from the second time the function runs. 

Kind regards and thanks for the help!

Userlevel 7
Badge +22

Hi @joana.m.machado ,

Can you just check what the integration run log transaction returns as well? May be this would give you kind of an idea at the transaction level (since you have already enabled the logging on the process)

Apart from that,  could you please try this way just to confirm whether the function result works accordingly instead of calling that in the value section on the mapping tab. 

Keep the execution point with On Mapping. Go to the process result mapping section in the processes tab. Create a new record. Add the related FSM table name and column name that you need to map. Then the column returned by the function will be called on the result path field. Remove the function call on the value section under mapping tab. Perform a refresh full cache and check this out? (Something similar to the example shown below) Also check the transaction log if you get any exceptions or weird results

 

Userlevel 2
Badge +6

Hi @Saranga Amaraweera, thanks! it is now working after defining the Process Result Mapping. 

 

Do you know if it is possible to have more than one Processes with the same/different name and with the same map function associated, the only thing that changes are the process arguments?

We have a generic map function that gives the description of a global code value, and we have an outgoing message where we are mapping two fields that have lookups to global_code_table and instead of sending the values to the external system we want to send the descriptions. However, the result is that both fields are sending with the same description that corresponds to the value obtained on the last function that runs. Is this the normal behavior? 

Kind regards and thanks for the help

Joana Machado

Userlevel 7
Badge +22

Hi @Saranga Amaraweera, thanks! it is now working after defining the Process Result Mapping. 

 

Do you know if it is possible to have more than one Processes with the same/different name and with the same map function associated, the only thing that changes are the process arguments?

We have a generic map function that gives the description of a global code value, and we have an outgoing message where we are mapping two fields that have lookups to global_code_table and instead of sending the values to the external system we want to send the descriptions. However, the result is that both fields are sending with the same description that corresponds to the value obtained on the last function that runs. Is this the normal behavior? 

Kind regards and thanks for the help

Joana Machado

Hi @joana.m.machado ,
Glad it did work as intended for you !

Well, this is somewhat tricky and I think it should be possible to achieve this requirement (if the expected behaviors are different) but you need to validate the input parameters in the generic integration map function to make sure whether the values are null or not null. I would suggest CASE WHEN (if else) statements in sql to do the validations of the input parameters. It’s possible to call the same map function with unique names more than once in the process tab. 

It would be best if you raise this question as a separate community thread as this is a different topic :)

Reply