First Steps with Joule Skill (Advanced): Request Badges for Multiple Users with Automation

Estimated read time 12 min read

It has been about three months since Joule Studio was released.
Several tutorials are already available on SAP Tutorials, and the community is slowly getting more active.  And, I think many people still wonder: “What can we really do with Joule Studio?”。

One of the tutorials is “Build Your First Joule Skill in Joule Studio.” In this tutorial, you create two Actions, Action to read data from an S/4 mock system and Action to create a badge. Then you use these Actions in a Joule Skill.

In this tutorial, you will create an action project for accessing business partner information from an OData service representing an SAP system. You will also create an action project for creating a badge request via an OData service representing a third-party system.

This tutorial is very good and easy to learn how to make Joule Skill. However, one of my colleagues asked me a question:

“What if we want to send badge requests for multiple users at once?”

With the tutorial as it is, you need to send a request to Joule one user at a time.

So in this blog, we will change the scenario and send badge requests for multiple users in one go.

There is one problem. In Joule Skill, we do not have loop control function like “Go to Step” in Process, “forEach” in Automation. Because of this, it is difficult to call Business Partner GET and Badge Create POST again and again inside Joule Skill only.

To solve this, we will use Automation inside Joule Skill. This is the final flow:

 

 

Step1 – Create a Skeleton Joule Skill

A Joule Skill can call Automaton (or Process). In this scenario, we will send a list of Business Partner Ids from the Joule Skill to the Automation. However, in the Joule Skill, the input parameter on trigger phase does not have a data type setting. It is treated as String only.

So, on the Joule side, Joule will enter IDs as one comma-separated string like “AAAA, BBBB”. And, inside the Automation, we will convert this String to a List of String. In the Joule Skill, we define the input parameter like:

Inputs Name: BusinessPartnerList Description: a list of BusinessPartner ID like “AAAA, BBBB”

(In the original tutorial, there are some other input parameters. To keep this blog simple, I will not use them here.)

 

Step2 – Create the Automation

Next, we create an Automation. Leave the Joule Skill editor, and go to SAP Build Lobby to create a new Automation project.

If you have not se up the Desktop Agent yet, plz follow this tutorial:
Install and Set Up Desktop Agent 3

At the beginning of the Automation, we use a Custom Script to convert the input String to a List of String. The image is like the following Javascript:

function parseIds(rawIds) {
if (typeof rawIds !== “string”) {
throw new Error(“rawIds must be a string like ‘AAA, BBBB’.”);
}

const ids = rawIds
.split(“,”)
.map(s => s.trim())
.filter(Boolean);

if (ids.length === 0) {
throw new Error(“No valid IDs found. Expected something like ‘AAA, BBBB’.”);
}

return ids;
}

With this, we can use forEach in the next step and process each ID one by one.

Next, open Project Properties(top-right gear icon), and select Manage Dependencies -> Add an Action Project Dependency. Here, add the two Action Projects from the original tutorial, Business Partner GET and Badge Create POST. 

Now we build the flow like this:

Convert the input String to a List by the “String to List” Custom ScriptUse forEach to take one ID at a timeCall the Action Get data from BusinessPartner APICall the Action Create Badge using the result

Finally, in Project Properties -> Attributes, connect the Agent attribute that you created when you set up the Agent.

When everything is ready, click Release -> Deploy. Then, to use this Automation from Joule Skill, go to the Lobby, open the correct version and click Publish to Library.

 

3. Use the Automation inside the Joule Skill

Go back to your Joule Skill, and add a Run Automation step. First, click Browse All Automations and select the Automation you just created.

Next, map the Joule Skill input parameter Business PartnerList to the Automation input.

After that, add a Send Message node in the next step. 

When the flow is ready, click Release -> Deploy for the Joule Skill as well.

 

4. Test the scenario

As I mentioned before, an Automation needs an Agent (and in the correct, “Agent” is not an AI Agent 😀). When we run an Automation from inside a Joule Skill, we must tell Joule which Agent to use.

Open Control Tower -> Environments, and go to the environment where your Automation and Joule Skill are deployed. In Agent Management, add the target Agent to that environment.

On your local PC, open the Desktop Agent settings and check that Agent Mode is Unattended.

In the environment screen, you will see a tab named “Joule” on the far right. Check the version of the Joule Skill you created, and click Launch to open Joule.

Now, try to send a prompt to test the Skill.

You can see that a badge request is created for each ID!!

Internally, the Automation is just running a forEach loop, so the same design works for both a single request and multiple requests in one run. In the future, if Joule Skills support file upload, we may also be able to read IDs from a file and send a large number of badge requests in bulk.

 

Conclusion

What do you think? With this approach, we can extend a Joule Skill by using our existing knowledge of SAP Build Process Automation. The way we design the Automation is almost the same as in other SBPA use cases. We simply call it from Joule.

On the other hand, there are still some gaps:

Joule Skill does not have flexible flow control like Go to StepWe cannot directly map Automation output to Joule Skill variables yet (SAP Help says there is an Output tab, but in my current environment I cannot see it.) 

Even with these limits, combining Joule Studio and SBPA already gives us many options. I am very excited to see how Joule Studio will grow in future updates!!!!

 

The CoE Japan team runs PoCs and scenario validations not only for Joule Studio, but also for many other SAP products. Through technical validations, architecture discussions, and sharing best practices, we support our customers and partners in getting more value from SAP from a technical point of view.

If you are thinking: “Can we do something like this with Joule or SAP Build?” please feel free to contact the CoE Japan team.

 

 

​ It has been about three months since Joule Studio was released.Several tutorials are already available on SAP Tutorials, and the community is slowly getting more active.  And, I think many people still wonder: “What can we really do with Joule Studio?”。One of the tutorials is “Build Your First Joule Skill in Joule Studio.” In this tutorial, you create two Actions, Action to read data from an S/4 mock system and Action to create a badge. Then you use these Actions in a Joule Skill.In this tutorial, you will create an action project for accessing business partner information from an OData service representing an SAP system. You will also create an action project for creating a badge request via an OData service representing a third-party system.This tutorial is very good and easy to learn how to make Joule Skill. However, one of my colleagues asked me a question:“What if we want to send badge requests for multiple users at once?”With the tutorial as it is, you need to send a request to Joule one user at a time.So in this blog, we will change the scenario and send badge requests for multiple users in one go.There is one problem. In Joule Skill, we do not have loop control function like “Go to Step” in Process, “forEach” in Automation. Because of this, it is difficult to call Business Partner GET and Badge Create POST again and again inside Joule Skill only.To solve this, we will use Automation inside Joule Skill. This is the final flow:  Step1 – Create a Skeleton Joule SkillA Joule Skill can call Automaton (or Process). In this scenario, we will send a list of Business Partner Ids from the Joule Skill to the Automation. However, in the Joule Skill, the input parameter on trigger phase does not have a data type setting. It is treated as String only.So, on the Joule side, Joule will enter IDs as one comma-separated string like “AAAA, BBBB”. And, inside the Automation, we will convert this String to a List of String. In the Joule Skill, we define the input parameter like:Inputs Name: BusinessPartnerList Description: a list of BusinessPartner ID like “AAAA, BBBB”(In the original tutorial, there are some other input parameters. To keep this blog simple, I will not use them here.) Step2 – Create the AutomationNext, we create an Automation. Leave the Joule Skill editor, and go to SAP Build Lobby to create a new Automation project.If you have not se up the Desktop Agent yet, plz follow this tutorial:Install and Set Up Desktop Agent 3At the beginning of the Automation, we use a Custom Script to convert the input String to a List of String. The image is like the following Javascript:function parseIds(rawIds) {
if (typeof rawIds !== “string”) {
throw new Error(“rawIds must be a string like ‘AAA, BBBB’.”);
}

const ids = rawIds
.split(“,”)
.map(s => s.trim())
.filter(Boolean);

if (ids.length === 0) {
throw new Error(“No valid IDs found. Expected something like ‘AAA, BBBB’.”);
}

return ids;
}With this, we can use forEach in the next step and process each ID one by one.Next, open Project Properties(top-right gear icon), and select Manage Dependencies -> Add an Action Project Dependency. Here, add the two Action Projects from the original tutorial, Business Partner GET and Badge Create POST. Now we build the flow like this:Convert the input String to a List by the “String to List” Custom ScriptUse forEach to take one ID at a timeCall the Action Get data from BusinessPartner APICall the Action Create Badge using the resultFinally, in Project Properties -> Attributes, connect the Agent attribute that you created when you set up the Agent.When everything is ready, click Release -> Deploy. Then, to use this Automation from Joule Skill, go to the Lobby, open the correct version and click Publish to Library. 3. Use the Automation inside the Joule SkillGo back to your Joule Skill, and add a Run Automation step. First, click Browse All Automations and select the Automation you just created.Next, map the Joule Skill input parameter Business PartnerList to the Automation input.After that, add a Send Message node in the next step. When the flow is ready, click Release -> Deploy for the Joule Skill as well. 4. Test the scenarioAs I mentioned before, an Automation needs an Agent (and in the correct, “Agent” is not an AI Agent 😀). When we run an Automation from inside a Joule Skill, we must tell Joule which Agent to use.Open Control Tower -> Environments, and go to the environment where your Automation and Joule Skill are deployed. In Agent Management, add the target Agent to that environment.On your local PC, open the Desktop Agent settings and check that Agent Mode is Unattended.In the environment screen, you will see a tab named “Joule” on the far right. Check the version of the Joule Skill you created, and click Launch to open Joule.Now, try to send a prompt to test the Skill.You can see that a badge request is created for each ID!!Internally, the Automation is just running a forEach loop, so the same design works for both a single request and multiple requests in one run. In the future, if Joule Skills support file upload, we may also be able to read IDs from a file and send a large number of badge requests in bulk. ConclusionWhat do you think? With this approach, we can extend a Joule Skill by using our existing knowledge of SAP Build Process Automation. The way we design the Automation is almost the same as in other SBPA use cases. We simply call it from Joule.On the other hand, there are still some gaps:Joule Skill does not have flexible flow control like Go to StepWe cannot directly map Automation output to Joule Skill variables yet (SAP Help says there is an Output tab, but in my current environment I cannot see it.) Even with these limits, combining Joule Studio and SBPA already gives us many options. I am very excited to see how Joule Studio will grow in future updates!!!! The CoE Japan team runs PoCs and scenario validations not only for Joule Studio, but also for many other SAP products. Through technical validations, architecture discussions, and sharing best practices, we support our customers and partners in getting more value from SAP from a technical point of view.If you are thinking: “Can we do something like this with Joule or SAP Build?” please feel free to contact the CoE Japan team.    Read More Technology Blog Posts by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author