Property 'webScript' does not exist on type 'AlfrescoApi'

cancel
Showing results for 
Search instead for 
Did you mean: 
Upladder
Active Member

Property 'webScript' does not exist on type 'AlfrescoApi'

I am going through the tutorial "Working with a Data Table"
https://www.alfresco.com/abn/adf/docs/tutorials/working-with-data-table/

When I am trying to run the code in "Playing with the data source" section, I get a error said

"
ERROR in app/src/app/mydatatable/mydatatable.component.ts:17:35 - error TS2339: Property 'webScript' does not exist on type 'AlfrescoApi'.

17 this.apiService.getInstance().webScript.executeWebScript(
"

How to fix it? or any materials I should read?

My mydatatable.component.ts code:

import { Component, OnInit } from '@angular/core';

import { AlfrescoApiService } from '@alfresco/adf-core';
import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core';

@Component({
  selector: 'aca-mydatatable',
  templateUrl: './mydatatable.component.html',
  styleUrls: ['./mydatatable.component.scss']
})
export class MydatatableComponent implements OnInit {


  data = new ObjectDataTableAdapter([],[]);

  constructor(private apiService: AlfrescoApiService) {
    this.apiService.getInstance().webScript.executeWebScript(
      'GET',
      'people',
      [],
      null,
      'api/-default-/public/alfresco/versions/1',
      null
    ).then(
      (response: any) => {
        let results = [];
        for (var entry of response.list.entries) {
          results.push({
            id: entry.entry.id,
            firstName: entry.entry.firstName,
            lastName: entry.entry.lastName,
            status: 'green',
            icon: 'material-icons://accessibility'
          });
        }
        this.data.setRows(results.map(item => { return new ObjectDataRow(item); }));
      }
    );
  }

  ngOnInit(): void {
  }

  onRowClick(event: any) {
    alert('We just clicked row id: ' + event.value.obj.id);
  }

}

Thanks.

4 Replies
KarekMedAM
Active Member II

Re: Property 'webScript' does not exist on type 'AlfrescoApi'

The tutorial may be out of date. I think the webscript has been deprecated from newer versions of the ADF and it is no longer available. I used EcmUserService and it worked.

4535992
Senior Member

Re: Property 'webScript' does not exist on type 'AlfrescoApi'

hei sorry to bother can you give a example of the new solution ?

KarekMedAM
Active Member II

Re: Property 'webScript' does not exist on type 'AlfrescoApi'

Use the EcmUserService.

  constructor(private userService:EcmUserService) { 
   
  }

getAllUsers(): void {


    this.userService.peopleApi.listPeople().then(
      (data:any) => {
        data = data.list.entries;    
      },
      (error: HttpErrorResponse) => {
      console.log (error.name + ' ' + error.message);
      });
  }

Then use data however you like to, just like any variable in angular.

justinmccune
Member II

Re: Property 'webScript' does not exist on type 'AlfrescoApi'

Hi! Could you explain to me where you found these? The EcmUserService isn't listed verbatim in the documentation?