06-19-2018 06:34 PM
Hi,
This is what i have done :
getActiveTasks (user): Promise<{}> {
const listScriptPath = 'api/task-instances?authority=' + user +
'&properties=wfvd_nomService,bpm_priority,bpm_status,bpm_dueDate,bpm_description&exclude=wcmwf:*&skipCount=0&maxItems=1000&';
return this.apiService.getInstance().webScript
.executeWebScript('GET', listScriptPath, this.scriptArgs, this.contextRoot, this.servicePath);
}
And this is what I get :
Is it possible to sort the results by id ?
I think i can use "orderBy" with "DESC" option in listScriptPath variable
but i don't find the correct syntax
thank you in advance
06-20-2018 07:43 AM
Is this a custom endpoint? Why do you fetch tasks via the webscript and not via the proper REST api?
06-21-2018 02:58 AM
Because I have reproduced the project Share version that uses this way...
06-21-2018 05:19 AM
So this what I try :
alfrescoJsApi = require('alfresco-js-api');
....getActiveTasks (user): Promise<{}> {
const requestTasks = new this.alfrescoJsApi.activiti.TaskQueryRequestRepresentation();
return this.apiService.getInstance().activiti.taskApi.listTasks(requestTasks);
}
and I get the following error :
error TS2304: Cannot find name 'require'.
Is-it the rirght way to retrieve asks user and if it is, how can i solve this error ?
Thank you
06-21-2018 05:22 AM
That example is for the node.js. Are you trying to use it with the node or with the Angular?
06-21-2018 05:26 AM
Angular
06-21-2018 05:29 AM
You can use one of the existing Angular services: alfresco-ng2-components/lib/core/services at master · Alfresco/alfresco-ng2-components · GitHub For example Alfresco JS Api gives you access to all the APIs: alfresco-ng2-components/alfresco-api.service.ts at master · Alfresco/alfresco-ng2-components · GitHu...
06-21-2018 06:04 AM
Thank you,
i have found a service:
this.apiService.getInstance().activiti.taskApi.listTasks(requestTasks);
requestTasks variable mut be TaskQueryRequestRepresentation type.
I have found this link that explain how to declare this type : adf-examples/ADF_2.0.0/javascript-api/angular2 at master · Alfresco/adf-examples · GitHub
(.7 Call Process API)
const requestTasks = new this.alf.activiti.TaskQueryRequestRepresentation();
So i try to define it like this :
How to define requestTasks ?
06-21-2018 06:15 AM
This is JavaScript and everything is dynamic You can create an object with JSON notation and cast it to any type if needed. The definition for IDE auto-completion is here: alfresco-js-api/index.d.ts at development · Alfresco/alfresco-js-api · GitHub
So you can create an object like:
const request: any = {
processInstanceId: 'value',
text: 'value',
otherProp: 'value'
}
06-21-2018 06:53 AM
Thank you, it's difficult for me to understand all the mechanism....
I get another problem when executing the instruction in my getActiveTasks method :
const requestTasks: any = {
processInstanceId: 'value',
text: 'value',
otherProp: 'value'
};
// const requestTasks = this.apiService.getInstance().activiti.TaskRepresentation;
return this.apiService.getInstance().activiti.taskApi.listTasks(requestTasks);
==> "ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'basicAuth' of null
TypeError: Cannot read property 'basicAuth' of null
at eval (alfresco-js-api.js:646)
at Array.forEach (<anonymous>)"
This is how my app works step by step :
And this the login html :
<adf-login
[backgroundImageUrl]="'./assets/images/loginbg.png'"
[logoImageUrl]="'./assets/images/klinck.png'"
providers="ECM"
[showLoginActions]="false"
[showRememberMe]="false"
(success)="loadData($event)">
</adf-login>
Thank you for your help
Explore our Alfresco products with the links below. Use labels to filter content by product module.