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

Getting the parent (case) id of a task description #243

Closed
gu-stahl opened this issue Apr 5, 2022 · 2 comments
Closed

Getting the parent (case) id of a task description #243

gu-stahl opened this issue Apr 5, 2022 · 2 comments
Milestone

Comments

@gu-stahl
Copy link

gu-stahl commented Apr 5, 2022

Request Type

Feature Request

Problem Description

The function find_tasks() returns a list of tasks including their identifying id's. I cannot see a way to find what case that task corresponds to (e.g. a parent_id being equal to the id of the case that owns the task).

Steps to Reproduce

  1. response = api.find_tasks(query={'status':'inProgress'}, sort=['-createdAt'])
  2. The response consists of a list of tasks with the status: inProgress, but there is no link to the cases with these tasks.

Possible Solutions

If the backend can return this information, have the json-response for a task contain the case id (parent_id), e.g.:
{
"_id": "~10128176",
"parent_id": "~23589374", <-----------------------
"_type": "case_task",
"createdAt": 1649142919313,
"createdBy": "user",
"description": "description"
"flag": false,
"group": "default",
"id": "~10128176",
"order": 1,
"owner": "user",
"startDate": 1649146266237,
"status": "InProgress",
"title": "Title",
"updatedAt": 1649142975316,
"updatedBy": "user"
}

Or maybe there is already a solution to this, but I have not been able to find it.

@chriswalkerc
Copy link

chriswalkerc commented Apr 5, 2022

I was just having the same problem with observables. The UI adds an additional parameter to the equivalent of the "params" structure in "__find_rows". I did a quick bodge to see how it would work & added in exactly what the UI put in:

params = {
"range": attributes.get("range", "all"),
"sort": attributes.get("sort", []),
"nparent": "10"
}

I'm not sure why the value of 10 is used for the nparent, but it did return the parent case under a 'case' structure within the usual JSON response.

@gu-stahl
Copy link
Author

gu-stahl commented Apr 6, 2022

I was just having the same problem with observables. The UI adds an additional parameter to the equivalent of the "params" structure in "__find_rows". I did a quick bodge to see how it would work & added in exactly what the UI put in:

params = { "range": attributes.get("range", "all"), "sort": attributes.get("sort", []), "nparent": "10" }

I'm not sure why the value of 10 is used for the nparent, but it did return the parent case under a 'case' structure within the usual JSON response.

That worked perfectly, thanks for the tip! This should really be a default for the find_tasks/observables functions.

@nadouani nadouani added this to the 1.8.2 milestone Apr 9, 2022
@nadouani nadouani closed this as completed Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants