SharePoint - workflow, read both the old-value and the new-value for a given It

Asked By mkamosk
26-Jan-07 12:21 PM
All --

Please help.

I am making some custom workflows with SharePoint Designer.

I need to be able to, in a workflow, read both the old-value and the
new-value for a given Item field.

Right now, all I can find is CurrentItem.FieldName for switching logic--
but, there is no descriminator so that I can get the "value before the
change" and the "value after the change".

How can this be done?

Part of the issue is that I need to send email as follows...

...start the workflow automatically when the document is created and when
the document is changed, and in the workflow run logic something like the
following...

If ((OldStatus DoesNotEqual ReadyForReview) And (NewStatus DoesEqual
ReadyForReview)) Then
Do send the email.
Else
Do not send the email.
EndIf

...the problem is, as you can see, that I need access to the old-value and
the new-value.

I am sure this can be done some way; but, I am new to workflows so I do not
yet know how.

Please advise.

Thank you.

-- Mark Kamoski
--
http://www.WebLogicArts.com
  David Mann replied...
27-Jan-07 05:28 AM
Hello mkamoski,

Could you grab the old status when the workflow kicks off and store it in
a variable (or in a hidden field on the item)?  It will then be available
when you kick off the workflow.

Another choice, if all you're doing is sending the email, would be to look
into Event Handlers instead of workflow.  I believe you can get to both before
and after values then.

Dave
  mkamosk replied...
27-Jan-07 03:35 AM
I tried this. In theory, it should work. However, in practice, there is a
detail that I cannot solve, which is a problem.

Maybe you can help with this further?

The problem was that I do not know how to make a custom column on a Document
Library list completely "hidden" from the enduser.

I can hide the column from every view; but, when one checks-out a document
and then opens it for editing in Word 2003 or Word 2007, then the Office
integration automatically shows the custom column in the Word interface.
Therefore, since the enduser can see the custom column, then the enduser
could potentially change the value, which would not be allowable for my
purposes because the field's would need to completed hidden from the enduser,
(or at least completely read-only).

In this case, the question becomes-- how can one add a read-only custom
column to a Document Library list?

Please advise.

Thank you.

-- Mark Kamoski
  mkamosk replied...
27-Jan-07 04:25 AM
You are right.

Using an EventHandler is a good idea. Both the BeforeProperties and
AfterProperties are available in some events.

Unfortunately, for me, I must use a Workflow for this.

If other ideas exist, then please post them.

Thank you.

-- Mark Kamoski
  Isha replied...
28-Jan-07 07:16 PM
You can hide or make a field readonly by changing the list schema, or you can
download the sharepoint tips utility pack which allows you to hide fields or
make them read only by code:
http://sps.uniqueworld.net/Canberra/Free%20Downloads/1/SharePoint_Tips_Utility_Pack.zip

Ishai Sagi
www.spstips.blogspot.com
  mkamosk replied...
29-Jan-07 09:13 PM
How can one change the list schema?

Would one use SharePoint Designer or something else?

Can you provide a hint on how to approach this?

Please advise.

Thank you.

-- Mark Kamoski
  Isha replied...
29-Jan-07 11:03 PM
A list schema is defined in xml in the site definition for the site you are
using. I have no links available now, but if I get some free time today I
will post some. I suggest you look into site definitions and CAML schemas in
google.

Ishai Sagi
  mkamosk replied...
30-Jan-07 04:14 PM
Regarding the issue of how to make a field read-only, that is nicely solved
by your excellent SharePoint Utility tool, that you link in a post above in
this thread,
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.sharepoint.development_and_programming&mid=cb6101ae-360f-4f10-8f00-b2cd34ec7321&sloc=en-us . so I really appreciate that nice tool.

Regarding the site definitions and CAML, I think that I see the direction
required there and I appreciate direction.

However (and unfortunately) I am still stuck.

Why?

Well, with the help of the SharePoint Utility Tool that you provided, it is
truly simple to set a field as read-only. Unfortunately, doing so apparently
writes to the Site Definition and/or CAML for the given List and that is,
apparently, the same location that the SharePoint Designer Workflow Builder
reads-- therefore, setting the field to read-only makes it read-only to
SharePoint Designer Workflows too. That is not what I need. What I need is
the field to be read-only to the enduser (so that he/she can in no way ever
change it) and at the same time making the field read-write to the SharePoint
Designer Workflow Builder.

The quest goes on.

It is proving to be very limiting that the SharePoint Designer Workflow
Builder does not provide access to both the old-value data and the new-value
data of the List item. I want to do something pretty basic-- if
OldStatus=SomethingOtherThanReadyForReview and NewStatus=ReadyForReview then
SendEmail. That's pretty tricky because I do not know what the OldStatus is.

It is beginning to look like I must use an EventHandler for this, which I
find to be VERY odd. The SharePoint Designer Workflow creator is really nice
but it seems to be missing a few things to make it great and really useful,
IMHO. Maybe (and I hope) this is just due to my lack of knowledge-- but, no
one seems to have an answer to this this anywhere.

If anyone has any more thoughts, please send them along.

Thank you.

-- Mark Kamoski
  Isha replied...
30-Jan-07 04:52 PM
Using my tool you can instead hide the field from the "new" and "edit" forms,
so the user can only "view" the field in the view form.

Ishai Sagi
  mkamosk replied...
02-Feb-07 09:16 AM
Yes. I see that now. That is great. It really is. You really might want to
promote your tool a bit. I will do it as much as I can. I am sure that it can
answer a lot of questions for a lot of people. FYI, this newsgroup
http://www.SharePointU.com is also pretty well travelled.

Now, I have another issue. I can now persist the old-value and new-value for
a given field in a given List by using a hidden field for the old-value. That
is fine. Unfortunately, to update the old-value as needed, the item needs to
be checked out. And, it seems, a checkout causes my Workflow to trigger
again, because it is set to start whenever an item changes. Therefore, my
Workflow runs 2x. Ug. Not good. I may have to use an Event Handler after all,
unless I find a better way.

Back to the drawing board. The problem that I am trying to solve is as
follows.

When a new item is created and whenever an existing item is changed in any
way, run the following simple logic...

Start the Workflow.

If ((OldStatus DoesNotEqual ReadyForReview) And (NewStatus DoesEqual
ReadyForReview)) Then

Send an email to A and B.

Else

Do nothing.

End If

Stop the Workflow.

In plain English, we have: If the Status changes from
SomethingOtherThanReadyForReview to ReadyForReview, then send an email;
otherwise, do nothing. There should be email sent only when the Status
changes to ReadyForReview. Unfortunately, the business processing is
non-linear; for example, it could go as: Status=NotSet, Status=Draft,
Status=ReadyForReview, Status=ReadyForPublish, Status=Draft,
Status=ReadyForPublish, Status=ReadyForReview, and so on. It can go from any
state to any state at any time.

If you, or anyone, has any hints on how to solve this, then please let me
know.

Thank you.

-- Mark Kamoski
  dontwantspamher replied...
02-Feb-07 09:22 AM
check my blog, I once wrote a sample on how to do administrative update for
an item to prevent recursive event trapping. I am not sure if that will solve
the workflow issue as well, but you might as well try,
--
Ishai Sagi
www.spstips.blogspot.com
Developer tips for SharePoint
help
project con sharepoint SharePoint SharePoint Portal Server Dev Discussions Sharepoint (1) Laurent (1) Cotton (1) Conectarme (1) Intentar (1) Liliana (1) Error (1) Project (1 Laurent Cotton www.bewise.fr es un error que sale al intentar conectarme con el sharepoint keywords: project, con, sharepoint description: !- - Web.Config configuration File- - configuration system.web customErrors mode = On deafaultRedirect = mycustompage.htm system
access into sharepoint SharePoint Sharepoint is new to my organisation and we are on the verge of deploying it to and import those? How have others resolved this issue? Your help is most appreciated, Matt SharePoint Discussions SharePoint (1) InfoPath (1) WSS 3.0 and MOSS 2007 (you didn't say which SharePoint product *and version* you were asking about) allow you with Access 2007 to synchronize (in both directions) Access tables and SharePoint Lists. It probably works in both directions (with some restrictions on field types used) although and then open that file using the template you created in InfoPath. keywords: access, into, sharepoint description: Sharepoint is new to my organisation and we are on the verge of deploying
Office SharePoint, Windows SharePoint and SharePoint Portal SharePoint Hi, I am a novice about SharePoint. Can anybody tell me if Office SharePoint, Windows SharePoint and SharePoint Portal are same thing? same server application? or what is the different among them? Thanks
Using a Windows Application to publish Office files to SharePoint SharePoint SharePoint 2.0, Office 2003, VS 2K5 In creating an automated document management Windows application, I need to be able to programmatically save (publish) various documents (.doc, .xls, .pdf, .tiff) to SharePoint, but I don't know which assembly to use. I tried system.io, but that on the URI class and WebRequests, but I just don't get it. Thanks, Ross SharePoint Development Discussions SPDocumentLibrary (1) SPListItem (1) SPList (1) SPSite (1) SPWeb (1) SharePoint (1) Lists.UpdateListItmes (1) Office 2003 (1) If you are using the windows application on a box that has access to the SharePoint server and SharePoint dll's, I would use the Microsoft.SharePoint namespace. If you used that namespace, you
wiki sharepoint SharePoint Hi Does someone know if there are any good wiki webparts available for sharepoint SharePoint Discussions Sharepoint (1) Webparts (1) SharePoint v3 (MOSS 2007 and WSSv3) includes Wiki functionality. Engelbert Have you heard about the Wiki to this work. Ben Aloha derksj, For 2003 I don't know of any, but SharePoint 2007 has a Wiki template included out of the box. -Ben- Ben M. Schorr - MVP http: / / www.rolandschorr.com Microsoft OneNote FAQ: http: / / www.factplace.com / onenotefaq.htm keywords: wiki, sharepoint description: Hi Does someone know if there are any good wiki webparts available for sharepoint