Fetching the employee tasks list from SAP ByD via OData API - sap-business-technology-platform

In SAP Business ByDesign (SAP ByD), a project can have multiple tasks and each task can have assigned multiple employees. So a single user has a list of tasks to book time on.
In the SAP ByD UI, you can select an employee and see all the assigned tasks. I would like to fetch that via the OData API. I started to click together some OData Services.
I have an Endpoint that allows me to filter for an employee:
https://my1234567.sapbydesign.com/sap/byd/odata/cust/v1/employees/EmployeeCollection?$format=json&$filter=EmployeeID eq '1234567'
With that, I can fetch information about an employee.
And I have an Endpoint to fetch ProjectTasks:
https://my1234567.sapbydesign.com/sap/byd/odata/cust/v1/project/ProjectTaskCollection?$format=json
That collection contains always a reference to the project.
And I have a ProjectParticipant collection that tells me which user is a member of which project:
https://my1234567.sapbydesign.com/sap/byd/odata/cust/v1/project/ProjectParticipantCollection?$format=json
And I can filter that ProjectParticipant collection by employee ID. With that I know which projects a user has assigned. But that does not tell me which exact tasks the user has assigned in the project. This last piece of the puzzle is missing.
I'm very new to SAP. If somebody can give me a hint for the right data model or API, I would be very thankful.

Related

How to filter data in CDS(powerapps) to restrict unauthorized users

I have created a custom entity in common data services(CDS) that streams in data from a survey.
I'll however need to give access to the data to various people. In my dataset, I have a column called community, which should represent which people have access to what data based on the community they've entered the column.
How exactly can I filter the data, after it has streamed in to ensure I only give access to people of a particular community. And yes every community is exclusive, no two people can be in two different communities.
I want to filter by the community, such that those in community A see only A and not B or C.
There’s no straight one step OOB configuration to achieve this. Because the row level security depends on the column value ie. community field value of each record.
One way is to create owner teams and add the users to right teams, then the custom entity record has to be owned by respective team - owner team of each custom entity record can be filled/assigned automatically based on the community field value on create using plugin/workflow/Flow.
Most important, in security role for that custom entity - read privilege has to be given only for user level. Assign the security role to Teams.

Assigned to field in Case Table- Servicenow

In Case Form,Based on the group selected in Assignment group field ,the assigned to field is listing some users which belongs to it in CRM UI.
Now I want to retrieve the same users using normal REST API. Please suggest REST API to list the users based on a group.
Users linked to groups is stored in table sys_user_grmember. In the example I search for all Users in Group named "Application Development".
GET https://YOURINSTANCE.service-now.com/api/now/table/sys_user_grmember?sysparm_query=%22groupSTARTSWITHApplication%20Development%22&sysparm_limit=10
You can easily test the REST Api with the rest api explorer from SNOW: https://YOURINSTANCE.service-now.com/nav_to.do?uri=%2F$restapi.do
Can you give more info on the exact requirement, so i can be more precise?
As far as I know, you can create a rest message to get the users inside a group and show the list wherever you want.
This would require three things from your side.
a) Creating a rest message in Snow.
b) Creating a script includes calling the rest message.
c) A client script or trigger which initiates the rest call using client script.
Hope this helps.
Regards.

Laravel payment multi subscriptions

I am working on a SAAS project where users can create various projects. With each project, they can choose from 5 different plans. Each plan has its own costs per month. Hotjar is a kind of equal concept.
Now I want to arrange the subscription with Stripe. The problem with that was that a user can have a maximum x subscription, which of course was a shame. Then I decided to take 1 subscription that has several plans. But now I have a dilemma, to update the subscription you have to change the number via SubscriptionItem. Then you have to save yourself which plan has which SubscriptionItem_id for which user. That is quite a detour and can cause many problems.
Someone is a better way with Stripe or another payment software.
You don't necessarily need to store the subscritpion_item IDs, you can look it up via the subscription_item list API. All you need to do is store the subscription_id for your customers, and based on that ID you can retrieve the list of subscription_items:
\Stripe\Stripe::setApiKey("sk_test_9GavlLpfiKewqeCBXvRvmVgd");
\Stripe\SubscriptionItem::all(["subscription" => "sub_EQlPGjVj4o5luH"]);
Then you can handle the data part of the returned JSON object and update / delete / etc these subscription items.
If you only have the customer_id handy, then you can use the subscription list API (with status as well on the GET params) to retrieve the list of active subscriptions.

Best way to design microservice architecture when there is a dependency between databases?

We are planning to migrate our product to micro service architecture using spring boot.
I have few doubts/concerns for "each service should have separate database".
If I created separate database for each service, then how to handle the table dependency.
For example: I have 2 micro services.
1. Customer Service: it has "customer" table (fields: customerId, customerName, etc...)
2. Order Service: it has "order" table (fields: orderId, orderName, customerId, etc...)
Note: for simplicity I mentioned only 1 table in each service here.
When I tried to access the order details based on orderId, I may want to retrieve the details of customer also.
In this case, I have two options in my mind:
Using RestTemplate call the "customer service" GET of customerById API and fetch the required details and set it in the response of OrderDetails.
Create customer table also in Order Service and using database tool replicate the data from customer service to order service's customer table. i.e., any changes done to customer table in customer service database will reflect on order service's customer table.
So, I can easily fetch relevant data from order service itself.
Please suggest which one is preferable. If both doesn't make sense, please suggest best way to handle this.
Thanks.

Have workflow process do updates when an entity is associated/disassociated with another in Dynamics 365

In our Dynamics 365 instance, we've got a custom entity called Activity entry which is associated with out of box Project entity. These 2 entities are associated with a N:N relationship.
Hence, each project can have multiple entities associated with it.
Problem:
Get a total count of Activity entry entities when they're associated to the Project entity such that when
an Activity entry is associated with a Project entity, increment the activities count
an Activity entry is disassociated with a Project entity, decrement the activities count
What we've tried so far?
We've tried to implement a workflow process to get this thing, but couldn't understand this association/dis-association aspect
I know you asked about a workflow process but you can also create a plug-in for the Associate message to accomplish your requirement.
An Associate message plug-in is a bit different from plug-ins for other messages: You register it without specifying a primary or secondary entity. It therefore runs for every association made in your system.
Your code needs to check the execution context and see which two entities are involved. In your case, if the entities are Activity and Project, you can increment your counters.
Note that if you have two N:N relationships between these two entities, you will also need to check that you are responding to the correct relationship.

Resources