Occasionally, somebody will ask for help on a distribution list, and it turns into a really annoying case of hand-holding.

From: X

I'm using the XYZ toolset to do some document management, and I want the server to run a script whenever somebody tries to modify the master template, so it can run validations before accepting the update, such as verifying that the person making the change has received the proper approvals. Is that possible?

It turns out that this is something the XYZ toolset already knows how to do.

From: Raymond

You can create a conditions configuration file which adds a condition that validates that the request satisfies whatever conditions you require.

From: X

Yes, that is what I am looking for. Where can I find information on how to write the validation script and how to implement it on the server?

From: Raymond

On http://xyztoolset/, go to Server setup, then Conditions.

Another colleague with a lot of experience with the XYZ toolset stepped in with some more useful advice:

From: A

Instead of developing scripts from scratch, you may want to start with the pre-written scripts that come with the XYZ toolset add-on pack. There are already modules for things like scanning the Description field for approval IDs. Note also that you may want to include some way of changing the rules dynamically as your processes change (for example, maybe one of the approvers goes on vacation and delegates approval authority to somebody else, or maybe your project goes into a "no approval necessary" phase) rather than just hard-coding the rules.

From: X

That's a good idea. Is there a way to easily disable a validation script?

From: Raymond

Um, you can just build this into your validation script.

if (File.Exists(@"\\project\admin\no_validation")) {
   return Validation.Passed;
}

From: A

Or you can have a magic word in the Description that disables validation. Features like this and the one Raymond describes are available in the add-on pack. Look in the Sentinel and Description­Match modules.

From: X

I'm having trouble getting this working. The documentation says I should do something like

<condition file="$\path\to\file.ext"
           action="C:\path\to\validate.xyz" />

If I use a shared network path for my validation script, I get "access denied".

<condition file="$\Nosebleed\MasterTemplate.xml"
           action="\\project\admin\validate.xyz" />

If I use an internal path:

<condition file="$\Nosebleed\MasterTemplate.xml"
           action="$\Scripts\validate.xyz" >

I get "file not found". I added $\Scripts\validate.xyz to the document repository, so the server should be able to see it. Am I missing something obvious here?

(I like how this person just made up a feature, in this case, using a repository path as an action rather than a physical file path.)

From: Raymond

My psychic powers tell me that the account under which the server is running does not have access to \\project\admin\validate.xyz. And adding the validation script to the document repository allows the server to access it only if the server has an active (and up-to-date) workspace joined to the repository. Sure the server has a copy of validate.xyz, but that copy is in the repository database. (Adding a file to the repository is more than just a "copy" operation.)

I would not be surprised if having the server also maintain a live workspace in itself is not a recommended practice.

From: X

I agree with your assessment of the "access denied" issue, but I really don't want the validate.xyz script to reside on an external share. Where is the best place to put the script? On the server or a share?

From: Raymond

The documentation for the XYZ add-on pack recommends putting the scripts on the server, accessible via a share.

From: X

But that's what I did, and the result was "access denied."

From: Raymond

No, that's not what you did. The recommendation is to put the scripts on the server (C:\Scripts\validate.xyz) and then share out your scripts (net share Scripts=C:\Scripts) so administrators can update them remotely.

From: X

I read the XYZ Toolkit documentation for conditions, and it says "Get an IT-managed share created." I suppose I need to contact the IT department to have that done. Correct?

At this point, I got tired of hand-holding.

From: Raymond

You can read just as well as I can.

Privately, I sent a message to A:

From: Raymond
To: A

You can read just as well as I can.

Actually, that statement is a lie.

My colleague "A" replied, "Yes, I thought that to myself when you used that line last week, too!"