Forum Discussion

dkinsley's avatar
dkinsley
Creator II
4 years ago
Solved

Method to delete the effective date in a document that is in the preliminary state

I have a document in preliminary state that has an effective date and I need to delete it (preliminary documents should not have an effective date until it is released).  Please give me a C# server...
  • Gopikrishnan's avatar
    4 years ago

    Hi Don

    ARAS OOTB by default, set the effective date when the item is getting released and it will set to null when the new revision preliminary revision is created. If your instance is working in that way, then you can correct the existing item but using the below AML query

    <AML>
    <Item action="edit" type="Document" id ="ID of the version you want to update" version="0">
    <effective_date condition="is null"></effective_date>
    </Item>
    </AML>

    else, create a method and attach to the document item (onBeforeVersion)

    if(this.getProperty("state") == "Preliminary")
    {
    if(!string.IsNullOrEmpty(this.getProperty("effective_date","")))
    {
    this.setProperty("effective_date","");
    this.setPropertyCondition("effective_date","is null");
    }
    }
    return this;