Asset Management Suite

 View Only
  • 1.  CMDB Rule Help

    Posted Jan 23, 2009 02:04 AM
    I am working on a CMDB rule that when it runs it will modify some data classes; however I am stuck on one field. I am trying to modify a custom data class with the current date. I am unsure on what the best approach is?

    Column name = Received Date, Column type = datetime

    In the Source field I can choose between the following:
    <Value>
    <Null>
    <Auto Generate>
    <Expression>

    I was trying to use <Expression> then select Edit...
    Once I get into Edit Expression, I get the empty Expression string:
    in the Data source columns: (the only choice I have is "Resource Guid")
    Below that field I get Add column(s) from NS...
    I select "Add column(s) from NS..."
    I then get AttributePicerDlg -- Webpage Dialog
    The primary folder I see is Resource Attributes, underneath that I select the Data Classes folder.
    I don't see anything that has current date.

    Does anyone have any idea the best way to populate the field with the current date?


  • 2.  RE: CMDB Rule Help

    Posted Apr 13, 2010 11:34 AM
    HI Chris,
    I had a similiar need which I was able to do with a SQL query versus an expression.

    For my purpose, I had to update a date/time field in one of the software purchases data classes.
    What I used was a SQL query to pull all the fields from the table looking for any records with a null value in the date field.
    (ex. Select * from Inv_Software_Purchase_Details where [Purchase Date] is null)

    I added a DATE column in my SQL query to provide the current date.

    (EX. Select *, getdate() as DATE from Inv_Software_Purchase_Details where [Purchase Date] is null)
    you can verify the sql query results by clicking the "Display Select Resources" link.

    This query, when ran gave me all the fields in the table, and now a DATE field with the current date/time stamp.

    Keep in mind since we're doing a select * that it will try to map all the associated fields to the columns from the query. I simply went through and set all the columns I didn't want to update to blank so only my date field was the one being updated.

    Set the field of the data class you want to update with the new column (DATE) and test the rule.
    you will see that all the rows now have the updated data.

    Hope this helps.