Sharepoint list - autopopulate column with predefined looping list - sharepoint

I need to create a sharepoint list for task assignments. There is a predefined list of people to whom task should be assigned (Note: it does not need to be a sharepoint list, its just an example of displaying the needed data - employees names):
Ideally, the 'Assigned to:' column would automatically populate in the demonstrated manner:
Meaning, whenever a user adds a new element, he puts another Task, the assignment is done automatically in the given order. I've tried every idea that I came up with and nothing worked.
Any solution here highly appreciated.
I came up with temporary solution which assings random people [out of given 3] to newly created tasks. Solution + results below:
Resulting list:
Now, I need to replace the "rand" function in "Get item" [middle section] in Power Automate with anything that lists employees in given order, not randomly. Please advise
Working solution:

Seems kinda basic algoryhtmic problem.
What I suggest :
First load list of employees (Get Items activity)
Then use the ID column of the newly inserted item and apply the modulo of number of employees to get the index of the employee to assign the task to
then grab the nth employee login to assign the task

Related

How do I update a list item after adding it with Power Automate

I can't figure out how to do a very simple update of a column value in Power Automate in SharePoint online. I've seen examples of how to update an item on another list, but nothing that updates a value on the same item that was just added and triggered the workflow. Can anybody give me an example and maybe a very brief explanation?
I want to multiply the values of two columns and add it to a third column on the same item which will be blank. I used the formula to update the column I want using values from other columns. =[Dollar Amount]*[% Chance] but it says invalid syntax. There seems to be nothing intuitive in this new power automation and it's a horrible failure compared to how easy it used to be. MS is always making these mistakes.
The first method, you could use a calculated column.
=[% Chance]*[Dollar Amount]
Second method,use Flow.
Test result:
It's Power Automate, not power automation. Details matter.
First, try to set the column value when you create the item. Then you won't have to edit it. If you already know the values for [Dollar amount] and [% Chance] (Chance, really? Or Change?), then you can use these to generate the value before you create the item. You can do that in a variable or with a Compose action. Then create the item and refer to the variable or the Output of the compose action.
If this is not an option, you can use the Edit Item action and get the ID for the item from the action above that you used to create the item.
You say "MS is always making these mistakes." - It's more likely that the problem is a mismatch of data types, e.g. using text fields in calculations, or typos, or wrong syntax. That's not a mistake made by MS. Again, details matter.
Edit after comments: If the workflow is triggered by an item getting created, then you can use an Edit Item action and refer to the ID from the trigger item.

Adding data from one list to another with correct ID of list item SharePoint

We are trying to get around the limitation of Field Permissions in SharePoint by creating a second list which will allow users to edit what they are allowed, instead of the whole form. In this case, it is on field that is set to Person or Group (Dashboard). For reference, the Person or Group gets info from AD, I am not sure if that is standard or not info but thought to add it in.
We have created a second list that has two fields, one being a Person or Group (AddToDashC) and the second being plain text (CopyName), where a workflow triggers and sends the Person or Group to plain text as Display Name, as that is what shows in the Person or Group. Last Name, First Name. This workflow works fine.
On the main list, we have separate list items where the Dashboard field can be edited, being unique for each list item. I can’t figure out the logic to be able to match the IDs up so that we can transfer the CopyName information to populate the correct list item ID through a workflow. We have a Lookup on the first list (AddtoDashWFC) which grabs the plain text form, CopyName, but just trying to figure out how to populate it properly.
I was hoping to have an edit link next to each list item in the column, which will go to the second list but still link to the report through the ID.
Sorry for the seemingly basic question, I just can't get the logic.
List 2 Workflow so far
List 1 Workflow so far
Thanks,
Patrick

Calculated SharePoint Column

I have a simple calculated column in my SharePoint 2010 list. It takes the list item ID, adds 100 to it.
When my users are creating items in the list, the calculated column does not get updated unless I go in, edit the column (do nothing) and save it. It, in fact, gives all items a value of 101 unless I manually edit the column.
Is this typical or is there a work around for this issue?
Thank you!
It is not possible to create calculated column based on ID value. The Id of the item is created after the item is added to the list.
You should use workflow instead.
The problem with using a workflow to do this (as per the accepted answer) is that workflow can take an appreciable time to execute. So you cannot create the ID until AFTER the new item is saved and there is always the danger that simultaneous users can create ID clashes that you also have to handle. If the workflow (as on a busy system) takes several minutes to work, you can also get the problem of someone else editing the item before the workflow has finished which may cause the workflow to fail leaving the item without any ID.
As an alternative, you might consider using JavaScript in the NewItem.aspx page to lookup and increment a counter from a separate list. Note that you have to update the counter as you read it if you are doing this so as to ensure that other users don't accidentally get the same ID if creating entries at the same time. This means that you must not mind the counter incrementing even if a user subsequently cancels the new item without saving.
As you noticed in opening/saving an item, The Calculated Column is updated on every item change.
Does it work to have a Workflow read the Title and write (the same) Title?
The [ID] reference in the Calculated Column should be set.
No need for an extra LookupID column then.

Can I merge Sharepoint lists with unique value conflicts by updating metadata?

I am trying to merge or copy data from either an excel spreadsheet or another sharepoint list into a master list. The main "item number" column will enforce unique values, but each item will be assigned to multiple "project numbers" using metadata.
Is it possible to tell sharepoint to auto-update the metadata when duplicate items are added to the list? I could probably even edit the metadata manually if it would display the old entry for modification, but the only option I've seen is modify or delete the new item.
Sounds to me(from the description you have given) you are trying to collate several lists in to one and any data within each list you need to merge. Is this correct?
If so you will probably need to do a bit of custom code. Heres a little run through.
Get the list objects of the lists containing your items or grab your items from excel.
Iterate through each of the items in the list(or excel) importing the items over to the Master list.
Just before the above step you will need to check if the unique identifier already exists in the master list. If it does grab that item and update it if it doesn't continue adding the item as normal.
As always i would recommend you have a crack at it yourself. It's far more rewarding to make something work yourself and to be honest to do the above if you can read other peoples code it should take too long to copy(i mean reuse :P) other peoples code off the web to get the desired outcome.
I am not aware of a way you would be able to do this out of the box or via SharePoint designer.
Hope this helps
Truez

SharePoint 2010 - Create liste items with looping workflow - limitation of 5?

I have a little problem creating new list items (rows) with the help of a workflow in a list in SharePoint Server 2010. Here are the facts.
What I want to do:
Create an item in a main list. While creating this item, the user has to enter a number which specifies the number of list items that should be created in a secondary list.
When the item in the main list is created, a workflow starts.
This workflow should create the number of list items in the secondary list, that the user specified before.
What I have so far:
As I'm restricted to work with SharePoint Designer, I have no possibility to create a for loop (which, I have to say, is quite weak and annoying beacause it would simplify a lot of things). However, what I have so far is the following and it works to a certain degree:
The workflow on the main list:
This one starts when an item is created or an existing one is updated.
It creates a new list item on the secondary list. Amongst others, it passes the ID of the item that was just created, the number of items which should be created in the secondary list, and a counter value (initial value is 1).
The workflow on the secondary list:
Increases the counter value by 1
Saves the ID of the corresponding list item in the main list.
Saves the number of items which should be created in the secondary list.
And (if the counter is smaller as the items which should be created) updates the counter of the corresponding item in the main list (that's why I passed the ID before).
As the item in the main list is updated, the workflow starts again with the new counter value.
Actually, it's the same principle described in this forum contribution.
The problem:
Now here is the problem: Despite the fact that the loop works, the problem is that only a maximum of 5 items are created in the secondary list, but I never declared that anywhere. For example, if I create an item in the main list and I enter a number of 10, the counter stops at 5 and only 5 items are created in the secondary list. But if I enter a number that is lower than 5, everything works perfect. For example, if I want to create 3 items in the secondary list, it only creates 3 items and the counter stops at 3, as it should.
The question:
As I am quite new to SharePoint (I'm coming from the PHP/SQL-World, where - as you know - loops are absolutely no problem), my question is if there are any predefined limitations in regard of creating list items by a workflow, and if yes, how and where I could change them (if that is possible).
This page says the limit of five is built in to reduce server strain and prevent infinite loops.
I can't find it now, but someone said this could be avoided by adding "Pause for Duration" for a minute as the last step of the looping workflow.

Resources