Is there an API that shows the user task histroy on the Camunda side? - spring

I have a Camunda flow, there are 2-3 user tasks in this flow. I want to see their history after completing these tasks. There are a couple of methods, but I just want to get both the label and the entered value with rest-api.
I can't get them directly with rest-api.
The following method returns variables with the processInstanceId.
List<HistoricVariableInstance> instances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processIntanceId)
.list();
but I need to call another rest-api to get the labels. GET /process-definition/{id}/xml with this api.
Other topics have been opened for this, but it does not meet exactly what I want.
similar question

I think you are right, you need 2 steps. I would combine the following requests:
First get all User Tasks:
GET /history/task -see API Reference
From its result Array you need the id and the name (which is the label):
[{"id":"anId",
...
"name":"aName",
...
}]
Now you can get the variables for each UserTask, like
GET /history/variable-instance?taskIdIn=YourTaskId see API Reference

https://docs.camunda.org/manual/7.16/reference/rest/history/variable-instance/post-variable-instance-query/
returns the name (label) and the value of the process variables
[
{
"id": "someId",
"name": "someVariable",
"type": "Integer",
"variableType": "integer",
"value": 5,
"valueInfo": {},
"processDefinitionKey": "aProcessDefinitionKey",
"processDefinitionId": "aProcessDefinitionId",
"processInstanceId": "aProcInstId",
"executionId": "aExecutionId",
"activityInstanceId": "aActivityInstId",
"caseDefinitionKey": null,
"caseDefinitionId": null,
"caseInstanceId": null,
"caseExecutionId": null,
"taskId": null,
"tenantId": null,
"errorMessage": null,
"state": "CREATED",
"createTime":"2017-02-10T14:33:19.000+0200",
"removalTime": "2018-02-10T14:33:19.000+0200",
"rootProcessInstanceId": "aRootProcessInstanceId"
}
]

Related

Is there a way to write an Expression in Power Automate to retrieve item from SurveyMonkey?

There is no dynamic content you can get from the SurveyMonkey trigger in Power Automate except for the Analyze URL, Created Date, and Link. Is it possible I could retrieve the data with an expression so I could add fields to SharePoint or send emails based on answers to questions?
For instance, here is some JSON data for a county multiple choice field, that I would like to know the county so I can have the email sent to the correct person:
{
"id": "753498214",
"answers": [
{
"choice_id": "4963767255",
"simple_text": "Williamson"
}
],
"family": "single_choice",
"subtype": "menu",
"heading": "County where the problem is occurring:"
}
And basically, a way to create dynamic fields from the content so it would be more usable?
I am a novice so your answer will have to assume I know nothing!
Thanks for considering the question.
Overall, anything I have tried is unsuccessful!
I was able to get an answer on Microsoft Power Users support.
Put this data in compose action:
{
"id": "753498214",
"answers": [
{
"choice_id": "4963767255",
"simple_text": "Williamson"
}
],
"family": "single_choice",
"subtype": "menu",
"heading": "County where the problem is occurring:"
}
Then these expressions in additional compose actions:
To get choice_id:
outputs('Compose')?['answers']?[0]?['choice_id']
To get simple_text:
outputs('Compose')?['answers']?[0]?['simple_text']
Reference link here where I retrieved the answer is here.
https://powerusers.microsoft.com/t5/General-Power-Automate/How-to-write-an-expression-to-retrieve-answer/m-p/1960784#M114215

Query specific value in array from a metadata entity in Dynamics 365

I'm trying to avoid iterating through this array, but I imagine that is the only way to handle this. Just seeing if there is a way to directly query this value in the array from the Web API URI.
This is the URI example:
https://example.crm.dynamics.com/api/data/v9.0/GlobalOptionSetDefinitions(f4a9de67-1d00-ea11-a811-000d3a33f702)
And this is an example of the response:
{
"#odata.context": "https://example.crm.dynamics.com/api/data/v9.0/$metadata#GlobalOptionSetDefinitions/Microsoft.Dynamics.CRM.OptionSetMetadata/$entity",
"MetadataId": "f4a9de67-1d00-ea11-a811-000d3a33f702",
"Options": [
{
"Value": 799680006,
"Color": "#0000ff",
"IsManaged": false,
"ExternalValue": "",
"ParentValues": [],
"MetadataId": null,
"HasChanged": null,
"Label": {
"LocalizedLabels": [
{
"Label": "ABC123",
"LanguageCode": 1033,
"IsManaged": false,
"MetadataId": "b4eb2c69-b500-ea11-a811-000d3a33fe19",
"HasChanged": null
}
],
"UserLocalizedLabel": {
"Label": "ABC123",
"LanguageCode": 1033,
"IsManaged": false,
"MetadataId": "b4eb2c69-b500-ea11-a811-000d3a33fe19",
"HasChanged": null
}
}
}
]
}
Basically, I have the "Value": 799680006 which is what I want to somehow add to the URI query parameters, so that I can ultimately get "Label": "ABC123".
Any suggestions or is iterating through the array of objects with if Value = x really the only option?
Let me clarify two things:
Querying metadata like you are using GlobalOptionSetDefinitions to get all the localized labels if you have multiple language packs or for verifying customizations or for Devops deployment purpose is one thing
Getting the label for the selected picklist value in one of the transaction database record is another purpose
If you simply need for second purpose, you can get it by selecting the Formatted value, after adding a header in web api request. Read more in my SO answer
Another way to inspect the label is using stringmap entity.
https://crmdev.crm.dynamics.com/api/data/v9.1/stringmaps?$filter=objecttypecode eq 'account' and attributename eq 'accountclassificationcode' and attributevalue eq 1

Get the list of action items from Google Drive API

Hi, everyone.
I have been trying to use Google Drive API for getting a list with the action items assigned in all files (docs or spreadsheets) in my company's domain using Spring Boot and the google-api-services-drive, but I have faced some issues:
Looks like there is nothing about action items on the API.
Comments are the closest I could get, but they don't include action item information. They only have the emails of people who were mentioned.
Documentation looks broad and not precise. For instance, here they say files resources include an indexableText property, but it is not present on the response.
As explained in Term for followup, looking for actionitems you can apply a query for getting the files with action items. Why is the fullText field not available in the response, or some other equivalent attribute to see the actual content and use it as a workaround to get the action items?
I just need to know who was assigned to the action item from the comment.
Any ideas?
Retrieve the action items with Comments: list specifying fields as comments/replies/action
I agree with you that it is not straightfoward, but there is a way to retrieve the full comment content including action items.
Use Files:list specifying q as fullText contains 'followup:actionitems', just as in the post you mentioned
For each of the retrieve items, use the fileId for the method Comments: list
For better understadning specify first the fields for Comments:list as * - this will return you the complete reponse looking as following:
{
"kind": "drive#commentList",
"comments": [
{
"kind": "drive#comment",
"id": "AAAAGlyxwAg",
"createdTime": "2020-06-08T09:04:34.907Z",
"modifiedTime": "2020-06-08T09:05:07.279Z",
"author": {
"kind": "drive#user",
"displayName": "XXX",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "+\u003ca href=\"mailto:YYY#YYY.com\" data-rawHref=\"mailto:YYY#YYY.com\" target=\"_blank\"\u003eYYY#YYY.com\u003c/a\u003e Could you please check the spelling?",
"content": "+YYY#YYY.com Could you please check the spelling?",
"deleted": false,
"resolved": true,
"quotedFileContent": {
"mimeType": "text/html",
"value": "Hello"
},
"anchor": "kix.94ksxclyqix",
"replies": [
{
"kind": "drive#reply",
"id": "AAAAGlyxwAo",
"createdTime": "2020-06-08T09:05:02.999Z",
"modifiedTime": "2020-06-08T09:05:02.999Z",
"author": {
"kind": "drive#user",
"displayName": "YYY",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": false
},
"htmlContent": "Will do!",
"content": "Will do!",
"deleted": false
},
{
"kind": "drive#reply",
"id": "AAAAGlyxwAs",
"createdTime": "2020-06-08T09:05:07.279Z",
"modifiedTime": "2020-06-08T09:05:07.279Z",
"author": {
"kind": "drive#user",
"displayName": "YYY",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": false
},
"deleted": false,
"action": "resolve"
}
]
}
]
}
This response contains the following information:
The quoted file content (the text to which the comment refers)
The content of the initial comment and the replies
The user to whom the comment was assigned
The reply of the user including his user name
And finally, the action taked by the user
Now, if you are not interested in all fields but only in the action, you can see that action is a resources nested in comments/replies
To query for action, replace the * in fields with comments/replies/action
as for your question about indexableText, the documentation specifies that it is a property of contentHints and
contentHints
Additional information about the content of the file.
These fields are never populated in responses.
A way to make indexableText "useful" is e.g. apply it in queries like
Files:list with q : fullText contains 'indexableText'
The good new are that if you not happy with the way how actions are retrieved now and can think of a better method to implement it, you can file a Feature request on Google's Public Issue Tracker. If enough users show interest in the feature, Google might implement it in the future.

Generating GraphQL GUI from Schema and Schema from GUI

While using GraphiQL works well, my boss has asked me to implement a user interface where users can check elements presented to them via UI elements like checkbox, map relationships and get the data and doing this will generate a graphql input for the person, call the API and get the result back to the user.
So, basically this involves 2 generations. Generating a user interface from a GraphQL schema and generating a GraphQL input query from the user's selection.
I searched and I was not able to find any tools which already do this. My server is in Node and I am using Express GraphQL. I converted my express schema to GraphQLSchema language using https://github.com/graphql-cli/graphql-cli and I introspected the GraphQLSchema language using the introspect function at https://github.com/sheerun/graphqlviz/blob/master/cli.js
The object which I got was something like this (only partial schema output given below)
`
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
"types": [{
"kind": "OBJECT",
"name": "Query",
"description": null,
"fields": [{
"name": "employee",
"description": null,
"args": [{
"name": "ecode",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
}],
`
I am looping through the elements trying to generate UI but I am quite stuck.
What is the best way to do this? Thanks in advance.
Well for the part of generating the ui from the introspection query, I think that the response contains enough data for a sufficient ui (description for each field can be used as a placeholder for each field's input box). If you're asking how can you generate a dynamic form from the introspection response, you can take a look at other projects that created transformers from json to html forms for inspiration/usage (take a look at https://github.com/brutusin/json-forms/blob/master/README.md#cdn). For complex fields (not primitive types) you may need to do some more work.
For the schema generation from the ui, you can use any query builder tool, and build a query according to the user inputs. Each combobox will be mapped to a specific SCHEMANAME.FIELDNAME and the value will be the value of the input box.
I hope it helped a bit. BTW, it sounds like an interesting tool so let us know if you succeed!

Updating value to NULL using Spring Data REST and PUT Method

I am using Spring Data REST using a CRUD repository, some values should be optionally NULL, however if I try to set them to null, the fields in question get ignored. If I send non-NULL data it works as expected
Is there are a way to allow this functionality?
Here is a sample PUT request body
{
"name": "Ash Test",
"distance": null,
"paid": null,
"startDate": null,
"tags": [ ],
"position": 3,
"creator": true,
"memberId": 55
}
This appears to be a known issue at the time of this writing:
https://jira.springsource.org/browse/DATAREST-130
It affects both SDR 1.0.0.RELEASE and SDR 1.1.0.M1. I just tried it with 2.0.0.BUILD-SNAPSHOT and the nulls don't currently go through there either.

Resources