Set dispositions to "N/A" on all affected documents with action set to "Revise"

I added this method under the "Server Events" tab, client-side, C# but it does not work. What is incorrect?

if (this.getProperty("action") == "Revise" && this.getProperty("item_type") == "Document") {
    this.setProperty("dispo_assemble","N/A");
    this.setProperty("dispo_repairs","N/A");
    this.setProperty("dispo_stock_kit","N/A");
    this.setProperty("dispo_supplier_stock","N/A");
    this.setProperty("dispo_wip","N/A");    
}
return this;

Parents
  • We currently have an affected item server event that populates all four of the dispositions when the affected item action is “Release”. This happens when the user adds the affected items and then saves the CN. The event is set to “onBeforeAdd”. This is the script:

     

    if (this.getProperty("action") == "Release") {

                    this.setProperty("dispo_assemble","N/A");

                    this.setProperty("dispo_repairs","N/A");

                    this.setProperty("dispo_stock_kit","N/A");

                    this.setProperty("dispo_supplier_stock","N/A");

                    this.setProperty("dispo_wip","N/A"); 

    }

    return this;

     

    I need to add something similar for affected items that are set to the action “Revise” but only for item type “Document” (not part). The item_type “Document” is not displayed until after the save occurs. I created the following script but it does not work. The item_type property “Document” is not populated until after the save so I don’t know which event to use. I think I have the script correct but not sure.

     

    if (this.getProperty("action") == "Revise" && this.getProperty("item_type") == "Document") {

                    this.setProperty("dispo_assemble","N/A");

                    this.setProperty("dispo_repairs","N/A");

                    this.setProperty("dispo_stock_kit","N/A");

                    this.setProperty("dispo_supplier_stock","N/A");

                    this.setProperty("dispo_wip","N/A"); 

    }

    return this;

  • Hello,

    The type of item a request affects can be found in the type attribute of the request as you can see below.

    <AML>
        <Item type="Document" action="add">
             <!-- Property data would be here -->
        </Item>
    </AML>

    You can access this data most easily by using the getType() function, so your if statement could be easily modified to instead check for the type of item like so.

    if (this.getProperty("action") == "Revise" && this.getType() == "Document")

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

  • Chris,

    Not working.

    When we create a new affected item relationship we select "Revise" from the "Action" drop-down field. Then we search for the document number which displays in the affected item row. However, the item type (Document) does not display until we save. I have the following script set to the CN affected item server event "onBeforeAdd". The only data displayed at that time is the action and the document number. Is there a way to get the type from the document number (affected_id) displayed?

    if (this.getProperty("action") == "Revise" && this.getType() == "Document"){
        this.setProperty("dispo_assemble","N/A");
        this.setProperty("dispo_repairs","N/A");
        this.setProperty("dispo_stock_kit","N/A");
        this.setProperty("dispo_supplier_stock","N/A");
        this.setProperty("dispo_wip","N/A");    
    }
    return this;

Reply
  • Chris,

    Not working.

    When we create a new affected item relationship we select "Revise" from the "Action" drop-down field. Then we search for the document number which displays in the affected item row. However, the item type (Document) does not display until we save. I have the following script set to the CN affected item server event "onBeforeAdd". The only data displayed at that time is the action and the document number. Is there a way to get the type from the document number (affected_id) displayed?

    if (this.getProperty("action") == "Revise" && this.getType() == "Document"){
        this.setProperty("dispo_assemble","N/A");
        this.setProperty("dispo_repairs","N/A");
        this.setProperty("dispo_stock_kit","N/A");
        this.setProperty("dispo_supplier_stock","N/A");
        this.setProperty("dispo_wip","N/A");    
    }
    return this;

Children