cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the status of multiple calendar tasks in SAP Analytics Cloud using scripting?

rijin_baby
Participant

Hi SAP Community,

I have a requirement in SAP Analytics Cloud where I need to retrieve the current status of multiple calendar tasks within an analytic application using scripting.

  • I have manually created three calendar tasks named T1, T2, and T3, and I want to check their statuses programmatically.
  • I have tried using the "CalendarIntegration_1.getCurrentTask()" function, but it seems to work only with a single story/app opened from calendar integration.
  • Additionally, I'm aware of the "CalendarIntegration_1.createCompositeTask()" function, but I prefer not to create a task inside the application using scripting.

Is there any other way or function available in SAP Analytics Cloud scripting that allows me to retrieve the status of multiple calendar tasks in an analytic application?

I am wondering if there is an id for each calendar task just like the unique id's for story and analytic application

Any guidance or sample code would be highly appreciated.

View Entire Topic
N1kh1l
Active Contributor

rijin_baby

Have you tried the below.

Use the getCalendarTaskById() API

If you want to retrieve information about a specific task, you can use the getCalendarTaskById() API. Simply pass the eventId from the query string in the URL The analytic application or story doesn't need to be opened by clicking a work file from the calendar task to use this API.

https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/a727e860122944b0be6a8...

var tasks = CI_1.getRelatedTaskIds();
for (i=0;i<tasks.length;i++){	
	
var task_id = CI_1.getCalendarTaskById(tasks[i]);
}

Hope this helps !!

Nikhil

rijin_baby
Participant
0 Kudos

@nikhil_1486
I do have a questing regarding "Data Block Task"

var t3_block = CalendarIntegration_1.getCalendarTaskById("54B0368629DC0DC0E3285CC5E6F31B2E") ;
console.log(t3_block.getName());

This gives the following error

It appears that this error occurred due to a problem in the script you attempted to run. Check the script if possible.
Cannot read properties of undefined (reading 'getName')
TypeError: Cannot read properties of undefined (reading 'getName')

But the code works with all other types of calendar tasks. The issue is only with data block task

N1kh1l
Active Contributor
0 Kudos

rijin_baby

I think the variable did not get assigned. Please check if the below returns anything.

var t3_block = CalendarIntegration_1.getCalendarTaskById("54B0368629DC0DC0E3285CC5E6F31B2E") ;
console.log(t3_block);

Nikhil

rijin_baby
Participant
0 Kudos

nikhil_1486It gives "undefined". Also the same with Multifunction Action task also,

But the same code work for general task and review task

N1kh1l
Active Contributor

rijin_baby

I think the API's only support the below

  • general task

  • composite task

  • review task