Skip to Content
Technical Articles
Author's profile photo Johannes Huhn

Sample Scenario: SAP Analytics Designer API integration with SAP Analytics Cloud Calendar

Introduction

In fact, SAC’s calendar provides an integration into Analytics Designer. Analytic Applications can easily interact with SAC calendar processes and workflows via API. Moreover, Analytic Applications can programmatically participate in workflows to submit, approve or even reject SAC calendar events. Next to that, an Analytic Application can even create new workflows directly into the SAC calendar. The scenario in the video shown below will explain the capabilities along one scenario of Human Resources planning.

 

Video

Check out more enablement material here!

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gabriel Berthion
      Gabriel Berthion

      thanks Johannes for this blog.

      If I well understood you were able tocreate a new composite task in the calendar "on the fly" when you created a new position.

      Is there any possibility for you to share the script used in Analytic designer please ?

      Thanks in advance

      Author's profile photo Aleksey Salinin
      Aleksey Salinin

      maybe this video will help you, starting at 06:41 about the Calnedar API script

      Planning Process with Analytics Designer

      Author's profile photo Gabriel Berthion
      Gabriel Berthion

      thanks Aleksey !!!

      Author's profile photo Johannes Huhn
      Johannes Huhn
      Blog Post Author

      Great you appreciate the content. I pasted the code snippet below to start a new workflow:

      var newTask = CalendarIntegration.createCompositeTask({
      	 name: "Approve new Headcount",
      	 startDate:new Date(Date.now() + 10000),	 
               dueDate: new Date(Date.now() + 259200000), //+3 days
      	 workFiles: [{ //one single file, the current opened file
      		 //id: Application.getInfo().id,
      		 id: '99183002E75E0E06CD6D1CE0193D526B',
      		 type: CalendarTaskWorkFileType.AnalyticApplication,		 
      	 }],
      	//each user is a string
      	assignees: ["SMILLER" , "MYUSER"]
      });
      Author's profile photo Gabriel Berthion
      Gabriel Berthion

      thanks Johannes. In the meantime I finally found a way and did that script and added 2 rounds for reviewers. I also added a "non member by email" but I don't ubderstand how it works. The non member received the email but he still needs an SAC access when clicking the link received by email.  Unfortunately, we cannot add viewers for the moment :

      CalendarIntegration_1.createCompositeTask({
           name: "newCompositeTask 1",
      	startDate:new Date(Date.now() + 10000),
      	
           dueDate: new Date(2022, 0, 16, 0, 0, 0),
           workFiles: [{
               id: Application.getInfo().id,
               type: CalendarTaskWorkFileType.AnalyticApplication,        
           }],
          assignees: [Application.getUserInfo().id], 
          description: "Calendar Composite Task description",
          reviewers: {
              "1": ["USER1", "xyz@gmail.com"] // email is a non member
              ,
              "2": ["USER2"]
              }   
          }, {
          autoActivate: true
      });
      Author's profile photo Ioannis Angelopoulos
      Ioannis Angelopoulos

      Thanks Johannes for your video it was really helpful!

       

      I am looking for a way to get the names of the assignees and reviewers through the Calendar API but I can't find the proper API statement for that.

      Seems like you can create a Composite Task but what about if you have an already created Composite task (via your calendar) and just want to see the assignees and reviewers in your Analytic Application? Essentially I want to have the same information as when I click calendar toolbar->details where I can see the people involved.

       

      Best Regards,

      Ioannis

      Author's profile photo Anthony Sciascia
      Anthony Sciascia

      Dear Johannes,

       

      Is there a way to pass with API the context ?

      I have an application where projects will be created and we need to create a task for each project. We successfully tested the api to create a task in calendar from analytic designer but we would like the person who will approve (reviewer of the task) could reach the right project when clicking for approve or reject.

      Eg : we created a task with API to approve or reject the project ABC123. When the reviewer wants to approve, it should see only the project ABC123 and not an report where all project are displayed.

       

      Best regards

      Author's profile photo Nasser Itani
      Nasser Itani

      Hello Anthony,

      Question is how did you manage to create the task and submit it at the same time from the application.

      As per my understanding that you need to open the application from calendar so you will have the ability to submit. Otherwise it will gives an error.

      Thank you.

      Author's profile photo Anthony Sciascia
      Anthony Sciascia

      Hello Nasser,

      What we did is to add at the end a task.submit

      We had also some errors I suppose it is because creation sometimes creation is not finished yet when we submit it through the script.

      CalendarIntegration_1.createCompositeTask({
      name: "newCompositeTask 1",
      startDate:new Date(Date.now() + 10000),

      dueDate: new Date(2022, 0, 16, 0, 0, 0),
      workFiles: [{
      id: Application.getInfo().id,
      type: CalendarTaskWorkFileType.AnalyticApplication,
      }],
      assignees: [Application.getUserInfo().id],
      description: "Calendar Composite Task description",
      reviewers: {
      "1": ["USER1", "xyz@gmail.com"] // email is a non member
      ,
      "2": ["USER2"]
      }
      }, {
      autoActivate: false
      });

      Application.hideBusyIndicator();
      Application.showMessage(ApplicationMessageType.Success,"Your task " + name + " has been successfully created ! ");

      newTask.activate(false);
      newTask.submit();

      }

      hope it helps

       

      Author's profile photo Nasser Itani
      Nasser Itani

      Hi Anthony,

      I tried the above but still showing the same error that it needs to be opened through the calendar.

      by newTask in code you mean the composite task right ?

       

      Thank you.

      Author's profile photo Jef Baeyens
      Jef Baeyens

      Hi Johannes Huhn , Anthony Sciascia ,

      Is there alread a solution to passing context filters from a (API created) CalendarTask to open a pre-filtered application/story workfile?

      We want to pass a URLparameter (those starting with p_ in application designer).
      Or perhaps a story filter as context.

       

      e.g. we want analytics designer to generate a bunch of tasks and then centrally monitor data collection (e.g. to ten's of sales manager responsible for a certain region or customer group). Instead of manual process to generate them with calendar task wizard.

      Author's profile photo Anthony Sciascia
      Anthony Sciascia

      Yes a composite task the one created in the script.