SharePoint 2010 Foundation Update List Where clause - sharepoint

I need to update List A from a form submitted in List B, where B.username = A.username. I am used to using SharePoint 2010 Enterprise and some of the advanced tools that go with that, but right now I am stuck on 2010 Foundation.
I don't know if I'm just having a brain pfft or something, but I can't make it work. Is this a limitation of Foundation? In the workflow editor in 2010 Designer, I can say update List A with a value from List B, but somehow not submit a where clause. Can anyone help?
What I'm actually trying to do is have a list of all users on the network and the form from List B just updates the "Accept" or "Decline" by the user's name in the first list.
Any help would be appreciated.

Assuming this is one-to-one relationship - that is, the WF triggered on the item in List B would only ever update one item in List A - when you configure your "Update List Item" action within the WF and select a "List" other than 'Current Item', a section will appear at the bottom called "Find the List Item" that will allow you to define how the WF will find the item in List A to update.
See here:
Bear in mind though, when using SharePoint Designer, you're limited to one-to-one relationships, and the only 'where' clause you can apply is an equals filter whereby some value you have (be it from the current item, a WF variable, an initiation parameter or a static value) is compared via equals operator to a field in the remote List (i.e. your List A). Should you define a clause that could result in more than one match - again, your WF on List B cannot trigger an update to 'n' items in List A - you will see this warning:
Caveat: all these conditions only apply when creating a WF via SPD; if you have access to Visual Studio, you can use it to create & deploy workflows that do support updating multiple items in a remote list based on a single WF being triggered, querying the associated items through something other than an equals, etc.

Related

How to eliminate string;# prepended to list field in three-state workflow notification?

I need to include two list values, [Office] and [Position ID] in a three-state workflow Task Title, which only allows selecting one column via dropdown. SharePoint Designer is not an option. Office is a choice column, while Position ID is single line of text. So, I had the idea to combine the two columns into a calculated column. This works fine for views, and displays as expected. However, when included as a list field in the Task Title of a three-state workflow, SharePoint prepends string;# to the calculated column value. Is there any way to prevent or workaround this? I have tried various concatenation methods within the calculated column formula, but it does not seem to have any effect on the workflow notifications. Any help would be appreciated.
Per my test, I could reproduce your issue:
However this is a hard coded workflow and we cannot change it.
Currently we could only manually remove the string;# via editing the task title in related task list.

Update multiple SharePoint list Items

I have an InfoPath form that, when submitted to a SharePoint Form Library, also adds a single item to a Task List. Each item in the Task List contains a People field that may contain multiple names. I have code in the form that creates separate items in a Custom List, one for each name in the People field.
When I manually update the Status field in a Task List item, I would like a SharePoint workflow (I'm using Designer 2010) to update all of the Status fields for the corresponding items in the Custom List. The "Update list item" option in ShP 2010 workflows will only update a single list entry. Is there a way to update all of the Custom List items that correspond to the Task List item whose Status is being modified?
To update multiple list items simultaneously, use SharePoint batch update. Look at following links for more information:
MSDN - Visual How To - Batch Updating List Items in Windows SharePoint Services 3.0
http://apmblog.compuware.com/2009/01/20/sharepoint-using-batch-updates-to-speed-up-performance/
You can also use batch operations for inserting and deleting.
I have written two workflows on codeplex - one is https://rwomi.codeplex.com and one is https://umlisdw.codeplex.com/

Sharepoint LookUp field on Choice field?

How to create a lookup field for the Choice field..For eg: In a list i have Choice field and i have to create an lookup column in other list pointing to this choice field ..When i select this list this column is not appearing in the dropdown...Please let me know if there is any Limitation for that
It is not possible to create a lookup field for a choice (dropdown) field. There are two ways to resolve your problem: The programmatic approach and the workaround.
The programmatic approach involves an creating event receiver to do the magic - pretty work intensive. But there is an explanation here:
Sharepoint 2010 - How to use List Events to Set a Column's Value using Visual Studio 2010 (C#)
You can also just create another list, containing your choice field values and use a calculated field as a source for your lookup column. Check out the following explanation:
Using a lookup field on a choice field workaround
the programmatical Solution is at risk to run into an endless recursion:
The ItemAdded Event and UpdatedEvents are asynchrone. This means, that the command: this.EventFireingEnabled = false is not threadsafe. After systemUpdate you set EventFireingEnabled to true.
But because the ItemUpdated is asynchronus, you cannot guarantee, that the ItemUpdated for your system.update has already been called at this time!.
You can use calculated column is source list, that will display value of Choice column. Then you can add lookup column for this calculated field. It will work only for Choice column with single selection. For multiple selection you can use 3rd party components like that:
http://www.sparqube.com/SharePoint-Lookup-Column
It works out of the box for me... but the lookup option is is only available if you go to "List Settings" and click on "Create Column"
here is how I configured my column on sharepoint online (in 2019) and it works perfectly... this is copy and pasted from the list settings screen under this column...
Column name: Equipment List
The type of information in this column is: Lookup
Get information from: Equipment Master List
In this column: "Equipment Name" (dropdown selector of all the column names on the other list)
Allow multiple values (to be selected) [TICKED]
there are some notes lower down too..
Relationship
A lookup column establishes a relationship between list items in this list and related items in the target list. Specify the relationship behavior enforced by this lookup column when a list item in the target list is deleted.
When an item in the target list is deleted, cascade delete will delete all related items in this list. Restrict delete will prevent the deletion of an item in the target list if it has one or more related items in this list.
Enforce relationship behavior [CHECKBOX]
radio buttions:
Restrict delete
Cascade delete

Working with workflows and populating lists

Hey all,
I am currently building a workflow, i created a list (let say list A), when the user fills out the list (form) and clicks OK button the workflow kick starts. the first action of workflow should be populating all the fields(whatever filled by user) in the List A to List B (here list B has same columns as list A but some additional columns). How to built this action in workflow. Any thoughts are highly appreciated. Quite a newbie to Sharepoint, eager to learn more about it.
Suppose List A has name field, its being filled as XYZ, then workflow should be able to populate XYZ in same corresponding name field in List B. I hope I made it clear
The question is whether you want to use Sharepoint Designer or a Visual Studio Workflow.
In Visual Studio you have the full Sharepoint object model galore to your hands - the sky is the limit.
In Sharepoint Designer you only have a limited set of Actions which enable you to do stuff. Let me explain a SPD solution.
You basically want this:
List A
Field: Name
Field: Testing
Field: Age
List B
Field: Name
Field: Country
Field: Age
So basically you could transfer Name and Age from A --> B upon creating a new item in list A.
In Sharepoint Designer you can just create a list workflow for list A, which automatically starts upon a new item in the list. When the workflow starts it just needs to get all the data you just entered in the form. So you can use the action Set Workflow Variable and set different variables (of the same name) to Name, Testing, and Age from the item.
You now would have the item's data as workflow variables.
The action Create List Item is next, here you can select a list, an item should be created in and set fields for that list item to your variables. So you could set workflow variable Name to the item's Name in List B, similarly the Age.

Auto number column in SharePoint list

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!!

Resources