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.
Related
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.
I created in SharePoint a list. It has several columns, one of these columns is called assined to. It contains one or more person.
What i want, is that an email is send to the new person/s, if a new person is added to this column.
Now i searched a little bit, and found out that I should use Workflows to solve this problem. But the problem is the Workflow is started only automaticly if any changes are made in an element or when an element is created.
So my question is, is theire a possibility to trigger an email by content changes in a specified column.
By the way im working with a list in SharePoint 2013.
One way to accomplish this is to use an additional column on the list to track the previous assignment. Whenever an item is modified, the workflow can run and check the Assigned To field against the new Previous Assignment field. If they are different, the workflow can send the email and then update the Previous Assignment field to be equal to the current Assigned To value.
You can make the Previous Assignment field hidden from forms in the content type settings so that it won't be visible (and confusing) to users.
Yes, this would work. You would need to create a condition which checks on every change which is made to the item if the field "assigned to" is filled.
Here is nearly the same requirement at the MSDN Forums:
https://social.msdn.microsoft.com/Forums/office/en-US/112c2be9-5d3e-47d1-ad1c-06312de8a925/workflow-condition-assigned-to-is-not-empty?forum=sharepointcustomization
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.
I Want to have only unique values in a SharePoin List. To achieve this I can use 'ItemAdding' event handler as mentioned in the below link.
http://weblogs.asp.net/vikram/archive/2008/12/24/sharepoint-using-event-handler-to-make-a-column-unique.aspx
Now I have a Doubt: Suppose that two user tries to add list Item in the list with the same column value(which requires unique value) at the same Time. will ItemAdding event would be fired at the same time for both call? If so then there is a possibility that two items having same value in the column. Please confirm.
I think, this method allows you only to have semi-unique values in the column. That is, if everything is normal, it will be unique. However, you cannot compare the properties of two items being added simultaneously (and yes, it may happen, since IIS web server is multi-threaded). Hence you might have duplicate values as a result.
A workaround - implement a "ItemAdded" event handler, too and delete a newly added item, if it has that property the same as some other existing item. This will, of course, happen very rarely.
If you have enough concurrent users that this is likely to be a problem, SharePoint probably isn't the right tool for the job. If the value is created by the user, it is extremely unlikely that two users will be adding the same value at the same time. If it is automatically generated, you probably should be using something based on ID, which is known to be unique.
If you are worried about the possibility of duplicates anyway, just make sure that the field can be edited if you do end up with duplicates causing problems.
In a SharePoint list I want an auto number column that as I add to the list gets incremented. How best can I go about this?
Sharepoint Lists automatically have an column with "ID" which auto increments. You simply need to select this column from the "modify view" screen to view it.
You can't add a new unique auto-generated ID to a SharePoint list, but there already is one there! If you edit the "All Items" view you will see a list of columns that do not have the display option checked.
There are quite a few of these columns that exist but that are never displayed, like "Created By" and "Created". These fields are used within SharePoint, but they are not displayed by default so as not to clutter up the display. You can't edit these fields, but you can display them to the user. if you check the "Display" box beside the ID field you will get a unique and auto-generated ID field displayed in your list.
Check out: Unique ID in SharePoint list
If you want to control the formatting of the unique identifier you can create your own <FieldType> in SharePoint. MSDN also has a visual How-To. This basically means that you're creating a custom column.
WSS defines the Counter field type (which is what the ID column above is using). I've never had the need to re-use this or extend it, but it should be possible.
A solution might exist without creating a custom <FieldType>. For example: if you wanted unique IDs like CUST1, CUST2, ... it might be possible to create a Calculated column and use the value of the ID column in you formula (="CUST" & [ID]). I haven't tried this, but this should work :)
I had this issue with a custom list and while it's not possible to use the auto-generated ID column to create a calculated column, it is possible to use a workflow to do the heavy lifting.
I created a new workflow variable of type Number and set it to be the value of the ID column in the current item. Then it's simply a matter of calculating the custom column value and setting it - in my case I just needed the numbering to begin at 100,000.
it's in there by default. It's the id field.
If you want something beyond the ID column that's there in all lists, you're probably going to have to resort to an Event Receiver on the list that "calculates" what the value of your unique identified should be or using a custom field type that has the required logic embedded in this. Unfortunately, both of these options will require writing and deploying custom code to the server and deploying assemblies to the GAC, which can be frowned upon in environments where you don't have complete control over the servers.
If you don't need the unique identifier to show up immediately, you could probably generate it via a workflow (either with SharePoint Designer or a custom WF workflow built in Visual Studio).
Unfortunately, calculated columns, which seem like an obvious solution, won't work for this purpose because the ID is not yet assigned when the calculation is attempted. If you go in after the fact and edit the item, the calculation may achieve what you want, but on initial creation of a new item it will not be calculated correctly.
As stated, all objects in sharepoint contain some sort of unique identifier (often an integer based counter for list items, and GUIDs for lists).
That said, there is also a feature available at http://www.codeplex.com/features called "Unique Column Policy", designed to add an other column with a unique value. A complete writeup is available at http://scothillier.spaces.live.com/blog/cns!8F5DEA8AEA9E6FBB!293.entry
So I am not sure I can really think of why you would actually need a "site collection unique" id, so maybe you can comment and let us know what is actually trying to be accomplished here...
Either way, all items have a UniqueID property that is a GUID if you really need it: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.uniqueid.aspx
Peetha has the best idea, I've done the same with a custom list in our SP site. Using a workflow to auto increment is the best way, and it is not that difficult. Check this website out: http://splittingshares.wordpress.com/2008/04/11/auto-increment-a-number-in-a-new-list-item/
I give much appreciation to the person who posted that solution, it is very cool!!