Weird Workflow Behavior in Sharepoint 2007 - sharepoint

I have a Document Library A and a list B.
When a document added to A, an item is created in B with the Title = A.Url. Another workflow runs whenever a document is updated in A which makes a lookup: B.Title = A.Url, and changes another column in B in found item.
Item Change Workflow always gives "Error Occurred: List item is not found". I modified the workflow to send me an e-mail containing the new (but unchanged) A.Url. It sent me the exact string with the one already in list B.
Anyways, why it can't find the item when the two columns are equal?
Thanks in advance.
Edit:
I literally hate Microsoft Sharepoint.

This is going to seem very unintuitive, but try "Building a Dynamic String" into a String variable, containing only [URL] from list A (or whatever the field name is). Then use this variable to perform your lookup against list B.
This voodoo magic has often worked for me when I encounter string comparison mysteries in SPD workflows.

Related

Declarative SharePoint 2013 Workflow Sending Email to Person Specific in Item List Field of Type Person/Group

I've been looking everywhere... for days. (I'm stubborn so I don't like asking questions before trying.) So here is the hardest question ever:
I have a SharePoint Online (2013) Custom List on which I'm running a Workflow. The association shows so the Workflow actually runs, and I receive email from it to one of the hard-wired emails.
The problem is getting an email dynamically, from a Person/Group field in the list. I have a field named ResponsiblePerson. When I try to get the value of that field (all I care about this "Person/Group" is the email), it seems to come as a null or empty string value.
I've tried many different variations to the following:
First I get the item.
Then I get values from the item. I just get ResponsiblePerson and put it in a variable called rp1. I tried to make this variable of type dynamic and string. Both didn't work, as I get an empty value in the email (see next step).
Finally, I send an email.
This email is addresses to a static email for testing. I get an empty rp1 otherwise I would have specified it in the To of the email activity (within a collection) and we would be done.
Use the field name + "Id".
Here is where I blog about this: http://mazdev.blogspot.ae/2014/05/get-value-of-persongroup-list-item.html

How do I expose the actual value of a Document Library custom column based on People and Groups in SharePoint 2013?

SharePoint 2013 in Office 365
I have added a custom column to a Document Library. The column is called "Author", and it is a lookup of type People and Group, filtered to show People only, and shows the field Name.
I have a workflow that is conditional upon the column being non-empty, but the Workflow builder doesn't have is empty or is not empty for that Current Item.FieldFromSource (Current Item:Author), so I've read the value into a string variable
Now I can check for existence:
However, I found that the behaviour of the Workflow was somewhat inconsistent, and as you probably know if you've read this far, Workflows are notoriously difficult to debug. So, I created a Task that would run after the loop, assigned to the CurrentUser, that would show the value of the two data items (this in the Task Description):
Value of author = [%Variable: Author_Value%]
Other author = [%Current Item:Author%]
When I run the Workflow (having set the Author to Joe Bloggs) and examine the Task, instead of the author's name it has more-or-less gibberish.
Two questions -
1 - how can I output the Name of the Author, since that's what I thought I'd done?
2 - why is there not an is empty / is not empty for lookups? All of them, no matter what they are bound to, only seem to expose equals / not equals.
Thanks, and hope this makes sense!
Edward
Just discovered that outputting the Current Item:Author as string is the issue - I've changed this to Display Names, Semicolon Delimited and it all works fine. I still don't understand why the condition builder on lookup columns doesn't give you more than equals / not equals but hey ho, this is SharePoint.

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: Calculated Column Values Disappear When Editing List Item. Any ideas?

I have a calculated column in a custom SharePoint 2007 list, with the following formula:
=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))
If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item.
So, on creation: "IR-40-TheTitleIsHere", but after edit, it is, "IR--TheTitleIsHere".
Anyone have some insight on why this would be happening?
I confirm the behavior mentioned above. Any Add/Edit will wipe out the [ID] portion. If you edit the column in the list and update the formula, it will update ALL list items to be correct (until you do an edit on the item).
I found this post that mentions the same problem.
Sounds like the only solution would be to make a simple workflow using SharePoint Designer that would update a text field in your list.
I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.
This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.
This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.
In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.
I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.
This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.
Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:
if (HTMLregexp.test(CellContent)) { //original pathtosharepoint line
if (NodeSet[i].parentNode.getAttribute("iid")){
var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
CellContent = CellContent.replace("SPIDReplace", SPID)
}
NodeSet[i].innerHTML = CellContent; //original pathtosharepoint line
This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010.
Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.
pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/
pathtosharepoint code: http://pathtosharepoint.com/Downloads

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