Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Get Process Instance Variable' does not unwrap Java variables #69

Closed
Noordsestern opened this issue Mar 16, 2022 · 0 comments · Fixed by #70
Closed

'Get Process Instance Variable' does not unwrap Java variables #69

Noordsestern opened this issue Mar 16, 2022 · 0 comments · Fixed by #70
Labels
bug Something isn't working

Comments

@Noordsestern
Copy link
Member

Test Data:

A process instance with a JSON variable

When getting variables from a process instance, the variable values are deserialized at Camunda side, leading to werid errors in python.

This seems to work

    @keyword("Get Process Instance Variable", tags=['process'])
    def get_process_instance_variable(self, process_instance_id: str, variable_name: str):
        """
        Returns the variable with the given name from the process instance with
        the given process_instance_id.

        Parameters:
            - ``process_instance_id``: ID of the target process instance
            - ``variable_name``: name of the variable to read

        == Example ==
        | ${variable} | Get Process Instance Variable |
        | ...         | process_instance_id=fcab43bc-b970-11eb-be75-0242ac110002 |
        | ...         | variable_name=foo |

        See also:
        https://docs.camunda.org/manual/7.5/reference/rest/process-instance/variables/get-single-variable/
        """
        with self._shared_resources.api_client as api_client:
            api_instance: ProcessInstanceApi = openapi_client.ProcessInstanceApi(api_client)

            try:
                response = api_instance.get_process_instance_variable(
                    id=process_instance_id, var_name=variable_name, deserialize_value=False)
            except ApiException as e:
                raise ApiException(f'Failed to get variable {variable_name} from '
                             f'process instance {process_instance_id}:\n{e}')
        return CamundaResources.convert_variable_dto(response) 
@Noordsestern Noordsestern added the bug Something isn't working label Mar 16, 2022
Noordsestern added a commit that referenced this issue Mar 16, 2022
* get java object from process instance variables   - closes #69

* introduce autotype conversion for process instance variables  #69

* typo

* fix test case
Noordsestern added a commit that referenced this issue Mar 16, 2022
* get java object from process instance variables   - closes #69

* introduce autotype conversion for process instance variables  #69

* typo

* fix test case

* fix documentation formating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant