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
Is this a custom endpoint? Why do you fetch tasks via the webscript and not via the proper REST api?
Because I have reproduced the project Share version that uses this way...
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
That example is for the node.js. Are you trying to use it with the node or with the Angular?
Angular
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...
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 ?
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'
}
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
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.