Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.
Endpoint Management Community Blog

Using Validation Rules with Data Macros to Enforce Workflow and Edit Rules

Created: 06 Jul 2006 • Updated: 11 Mar 2009 • 1 comment
ribak's picture
+1 1 Vote
Login to vote

The Altiris Helpdesk Solution provides a robust library of data macros to simplify the coding and implementation of business rules. The PREVIOUSITEM macro is a great tool to query the previous value of a field prior to updating the database. The PREVIOUSITEM macro combined with Validation Rules are a powerful combination of easy to use features that enforce workflow and business logic in the Helpdesk Solution.

The following example uses the PREVIOUSITEM macro to prevent the editing of an incident that has already been closed. This is useful in environments that have SLA agreements triggered by the closing of an incident and also prevents multiple notifications and reporting of closed incidents.

The rule can easily be imported into Helpdesk Solution and modified to meet your business requirements. Follow the steps below to import and test this rule in your environment.

Step 1: Create the import file

  1. Copy and paste the following text into Notepad.
<Helpdesk>
<ValidationRules>
  <ValidationRule>
    <Guid>7eee4bad-6c1c-4c38-95d5-9ac0c8bc60d3</Guid>
    <Name>Prevent edit of "Closed" incident except for Authorized Workers</Name>
    <Description>Do not allow worker to edit incident that is "Closed" status.</Description>
    <Status>active</Status>
    <Message>Incident WORKITEM(workitem_number) is "Closed" and cannot be modified.  Contact your System Administrator for further assistance.  Click Cancel (Red 'X') to return.</Message>
    <LogToNs>yes</LogToNs>
    <Rank>6</Rank>
    <ApplyTo>all</ApplyTo>
    <Criteria>
      <Criterion field="PREVIOUSITEM(workitem_status_lookup_id)" op="optEqual" value="600" type="uint" />
      <Criterion field="" op="" value="1" type="group" />
    </Criteria>
    <Criteria or_together="true" not_result="true">
      <Criterion field="workitem_modified_by_worker_id" op="optEqual" value="WORKER ID" type="uint" />
      <Criterion field="workitem_modified_by_worker_id" op="optEqual" value="WORKER ID " type="uint" />
      <Criterion field="workitem_modified_by_worker_id" op="optEqual" value="WORKER ID " type="uint" />
    </Criteria>
  </ValidationRule>
</ValidationRules>
</Helpdesk>

  1. Save the file as techtip.xml.

Step 2: Import the file

  1. In Helpdesk, click Admin > Import.
  2. Browse to the techtip.xml file and click the open button.
  3. Click the import button to add the rule.
Import Admin Data

Figure 1. Import Admin Data

Click to view.

Step 3: Test the rule

  1. Create or open an incident that is closed.
  2. Attempt to change the time, status, or add comments to the incident. The rule should not allow you to modify the incident as seen in the picture below
Edit Incident

Figure 2. Unable to edit incident

Click to view.

  1. Cancel out of the incident edit view.

Step 4: Modify the closed edit privileges

  1. Click Admin > Validation Rules > List Validation Rules
  2. View the "Prevent edit of "Closed" incident except for Authorized Workers rule."
List Validation Rules

Figure 3. List Validation Rules

Click to view.

  1. Note from the picture below that the sample rule contains 3 workers all equal to "Worker ID" who are authorized to make changes to closed incidents.
View Validation Rule

Figure 4. View sample rule

Click to view.

  1. Click pencil icon to modify the validation rule.
  2. Highlight and choose to edit the first line "Modified by worker is equal to 'Worker ID'."
  3. If you know the Worker ID number from the Altiris_incidents database worker table, type the Worker ID number and click OK. If you do not know the Worker ID, cancel out of this view.
Edit Validation Rule

Figure 5. Edit Validation Rule

Click to view.

  1. Instead, choose to add new line for "Modified by worker" and select "When the value of the 'Modified by worker:' is equal to 'Administrator'" or whichever worker you prefer to grant rights.
Edit Validation Rule

Figure 5. Edit Validation Rule

Click to view.

  1. Your worker should now have rights to modify any closed incidents and will bypass the validation rule.

Comments 1 CommentJump to latest comment

Greg Giles's picture

I just tried this tip and it worked like a charm. This gives me some pretty cool ideas on how to better use Validation Rules and HD macros. Thanks Richard.

0
Login to vote