Task Forwarding in Workflow sap - workflow

I have forwarded travel expense approval task from one manager to
another manager in sap fiori. Can anyone tell me how to get the
current approver?
Thanks

Are you able to use ABAP? Then this might solve your issue.
You need to enhance ABAP logic for this certain scenario in fiori.
determine your workflow, workitem id (wi_id)
determine current agent via
CALL FUNCTION 'RH_USERS_OF_WI_READ' "Get Current Agents (Users) for Work Item
EXPORTING
wi_id = " swwuserwi-wi_id
TABLES
user_tab = " swhactor
EXCEPTIONS
NOTHING_FOUND = 1 "
. " RH_USERS_OF_WI_READ
use HROBJID of swhactor to determine personnel number or central person
read name of HROBJID e.g. via infotype table PA0001 (e.g. field ENAME)

Related

Specific arrival times for agents

I have am model which simulates a distribution network.
I have a population of agents (customers), develop from a database (address -> Gis Location and the order time)
Also I have a order agent, which has a parameter "customer"
I have a source in the customer agent to generate orders and the code at source exit: agent.customer = this;
In the source I've set Arrival deffined by: Arrival table in Database and refer to the customer -> order time. My problem is, that I currently generating in every source of this population every order. How can I set up the source/model, that I generate at a specifc customer only the orders from this one?
Unfortunately, a Source object can only ingest the whole table and there is not function to filter records. One way to go about partitioning Order agents is by creating all of them in a single source somewhere in the model and then using Exit to send them to an Enter object within a specific Customer agent. To summarise:
There is a single Source that reads the 'Orders' table for all customers
Each record has a field with 'customer id' so when agent gets created it has a property of which customer it belongs to
Source object feeds all new Order agents into an Exit object
Each Customer agent has an id and an Enter object
Source's Exit object contains code which finds Customer agent based on 'customer id' property and then calls customer.enter.take(agent) to send the Order agent into the right Customer agent
More information about here: Enter and Exit.

OData Query to Only Return State Changes from Azure Devops

I have an OData Query that I am using to pull data into PowerBI that I am trying to make more efficient. I am doing a report from Azure DevOps and pulling data in from the WorkItemRevisions resource. Currently, I am pulling all the data for a Work Item and then filtering in PowerBI to only get when the State has changed. I would like to move this filtering to the Odata query so that I can minimize the data that I am pulling into the report.
Currently, I have a query like the following (simplified example used for this question)
https://analytics.dev.azure.com/{Organization}/{Project}/_odata/v3.0-preview/WorkItemRevisions?
$select=Revision,WorkItemId,WorkItemType,Title,State,ChangedDate,LeadTimeDays,ParentWorkItemId
How can this be updated so that only Revisions where the State has changed (from New to Active, Active to Done, etc) are returned?
How can this be updated so that only Revisions where the State has changed (from New to Active, Active to Done, etc) are returned?
I am afraid that OData Query could not perfectly achieve what we need.
There is a feature Revisions/any(r:r/state eq '{state}') to filter the work item has a set state in the past.
For example:
https://analytics.dev.azure.com/<Organization>/<Project>/_odata/v2.0//WorkItems?
$filter=State eq 'Closed' and Revisions/any(r:r/State eq 'Active')
This query is similar to a Work Item query that uses the Was Ever operator.
As I said, this may not be a perfect solution. That because it can only filter whether the work item has ever had a specified states, but cannot accurately determine the states of the work item must be from New to Active, Active to Done. If we change the state of the workitem from Active to Resolved, then change it from Resolved to Closed. Then this work item will appear in the query results.
In addition, even if you use the UI query, we cannot accurately query the result of the work item status changing from A to B. To achieve this goal, we need to use REST API.
So, we could use the feature Revisions/any(r:r/state eq '{state}') to reduce the data pulled into the report to a certain extent.
You can use below query to achieve what you want.
/_odata/v4.0-preview/WorkItemRevisions?&$apply=filter(((WorkItem/WorkItemType
eq 'Bug' or WorkItem/WorkItemType eq 'Product Backlog Item') and
((WorkItem/ChangedDate ge 2022-10-05Z and WorkItem/ChangedDate le
2022-11-04Z) or (WorkItem/CreatedDate ge 2022-10-05Z and
WorkItem/CreatedDate le 2022-11-04Z))))/groupby((WorkItemId,State),
aggregate(ChangedDate with min as MinChangedDate))
To filter the group by data you need to encapsulate it under $apply as it is shown above.
Above URL will return all states and their changed dates for Bug and PBI Work Item types which are added or updated with a given date range.
Hope it helps!
if you are able to use Analytics Views instead of OData, there is a dedicated field available in Analytics Views Fields setting called "State Changed Date"

How to set conditions to avoid duplicate run for Tasks creation for a User Story

I created a Power Automate flow to create 9 tasks (Dev, Testing, and BA tasks) as a child for a new user story when it is assigned.
It works fine but it is getting duplicated every time when the story is assigned back from Unassigned to a resource.
I tried to get the count of related tasks for the user story before creating them but couldn't find any default conditions to get that.
Is there any other condition to set to avoid this duplicate task creations?
Solution for the query to set a condition to check for the existing workitems before creating them has been provided by yashag2255 on the Power Automate forums:
To get the work items related to the user story, you will have to send a HTTP request for that. But before sending this request -> Go to Azure DevOps -> Queries -> My Queries -> Create a new blank query and save it. (In this example let us say TestNew).
After you have done this, in the flow under the trigger create an action as shown. Very carefully populate all the fields. (here 'yashTest' is my project, replace it with yours)
Body : {
"name" : "TestNew",
"queryType" : "tree",
"wiql" : "SELECT [System.Id],[System.Title],[System.State] FROM workitemLinks WHERE([Source].[System.WorkItemType] = 'Task' AND [Source].[System.Id] = )AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')AND ([Target].[System.WorkItemType] = 'Task')MODE (Recursive)"
}
in the "wiql" near the [System.Id] = select the ID of the work item retrived from the trigger action (the original trigger request that has the id of the assigned work item)
Now, create a new string variable to get the query ID and put the foloowing expression in the expression editor and add it to the string value.
body('Send_an_HTTP_request_to_Azure_DevOps')['id']
Now add another action: Get Query Results with the query ID in the previous step. This will fetch you a list of the work items related to the assigned work item. You can iterate thorough this to check if the items exist and if not create them with Create Work Item Action.
Source: https://powerusers.microsoft.com/t5/Building-Flows/How-to-set-conditions-to-avoid-duplicate-Tasks-creation-for-a/td-p/289629

Update sales order items using a workflow in NetSuite

I'm starting to get the hang of NetSuite but this one has stumped me. I am looking for a way to update the line items on an order from a workflow in NetSuite. From what I can tell it doesn't seem to expose those fields, is there any way around this?
I have a saved search returning all of the transaction line items that I want modified, there is a field on the Sales Order Line Item called "Create Fulfillment Order". It shows up under saved searches as "Create Fulfillment Order Column", but when I add an action to a workflow to set the field value, the only fields that show up are Sales Order fields. Is there any way to access the Sales Order Column fields, since that's really what's being returned by my saved search anyways.
I've looked at the Sub Types defined in the workflow to see if there's one for Sales Order Item or anything but there's not, just Sales Order. Any help would be greatly appreciated, thanks in advance!
There's nothing built-in that will let you access transaction line items from a workflow. You'll need to use SuiteScript to create a custom workflow action. Then you can call that action from your workflow.

InfoPath 2010: Mirror data from a Secondary Data Source

Goal: Pull data from a SharePoint 2010 List using a WEB ENABLED form. Then, from the repeating table that contains the secondary data, extract only the desired data and mirror it in my main form fields. The extracted data would then be modified, and submitted to another sharepoint list using Nintex Workflows or, if the IT department smiles upon this project, a database.
What I've Tried: Created a field, named "TEST_CyS", in a repeating group, named "TEST", in my main form fields to store the mirrored data. This field has a default value of:
xdXDocument:GetDOM("REMOVED")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[(count(../preceding-sibling::*[local-name() = "TEST"]) + 1)]/d:Cy_Statement
This is refreshed when the form updates.
If I set the default value to count(../preceding-sibling::*[local-name() = "TEST"]) + 1 it accurately counts each inserted group.
if I set the default value to xdXDocument:GetDOM("REMOVED")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[<INT>])]/d:Cy_Statement where <INT> is any whole value between 1 and n then the field will display the correct information, for the secondary data field whose index is referenced.
It's when I combine the two that things fall apart.
Main Data Tree:
Secondary Data Tree:
Assumptions: I am guessing that the preceding-sibling::*[local-name() = "TEST"] axis is not returning a value due to the fact that it's being called along with the GetDOM() method. I've tried to point the preceding-sibling back to the correct group in the Main form fields, but then I felt silly for trying that as it wouldn't know where to start counting AND infopath presented me with an error:
Function 'GetDOM' did not return a value, or it returned a value that cannot be converted to an XSL data type.
Summary: Is this a lost cause without code or purchasing some "plugin" for Infopath like qRules? The IT department will not budge on allowing Forms with code in them to be run on the SharePoint site, and the requirements placed on the form state that it must be a web enabled form to be filled out in SharePoint.
Edit: We also do not have access to VSTA, and the possibility of having it installed is very, very slim.
Is there an alternative method I could use to pull this off?
SharePoint admins don't need to be involved if the InfoPath form uses code, so long as it is limited to the SharePoint 2010 sandbox APIs.