Matt Paulhus's Profile
Agile Angel
1051
Points

Questions
25

Answers
144

  • Agile Angel Asked on August 30, 2018 in Agile PLM (v9).

    Hi Jason,

    Your PX will need to determine last approver simply by iterating over the workflow table and going from there like in the below lines (I can’t think of a better way):

    List arraylist = new ArrayList()
    ITable workflowtable = change.getTable(ChangeConstants.TABLE_WORKFLOW)
    Iterator iter = workflowtable.iterator()

    while (iter.hasNext()) {
       IRow row=(IRow)iter.next()
       String reviewer = row.getValue(ChangeConstants.ATT_WORKFLOW_REVIEWER)
       String signoffstatus = row.getValue(1111) //gets signoff status
       String processtatecode = row.getValue(3934) //gets current status or previous status, etc.

       if (processtatecode == “Current Process” && signoffstatus == “Awaiting Approval”) {
              arraylist.add(reviewer) 
       }
    } //done iterating through workflow table

    if (arraylist.size() == 1) {
                    obj.logMonitor(arraylist.join()+ ” is the last remaining approver for ” + eco_number)
                    //check for other fields and if invalid, throw an AgileDSLException to block the approval process, else do nothing an let the person approve
          }

    • 3860 views
    • 13 answers
    • 0 votes
  • Agile Angel Asked on August 24, 2018 in Agile PLM (v9).

    Yes, that sample would have stopped a user from approving if the important_value field is null and the eco will stay in the person’s queue.  The message is displayed as a pink-colored banner message on the signoff comment/approval window that pops up like my example.  

    RE: ECO workflows getting

    And like Swagato mentioned, if the field you need the script to review is a redlined field, you’ll need to get and iterate through the redlined BOM or redlined title block section if you’re looking for whether or not change controlled redlined fields are filled out or not:

    private static String check_redlined_titleblock (IItem item) throws Exception {
    Iterator titleblock = item.getTable(ItemConstants.TABLE_REDLINETITLEBLOCK).iterator();
    while (titleblock.hasNext()) { //start iterating through page two redlines and data
    IRow pagetworow = (IRow) titleblock.next();
    String important_value = pagetworow.getValue(ItemConstants.ATT_PAGE_TWO_LIST01)

    if (important_value  == “value_1” || important_value == “value_2”) {
    return important_value 
    }
    else return null } //done iterating through redlined page 2
    }

    • 3860 views
    • 13 answers
    • 0 votes
  • Agile Angel Asked on August 24, 2018 in Agile PLM (v9).

    True – I’m thinking about the technology solution here though certainly many of us think in either people or process terms that would make for a better, more comprehensive solution.
    The solution my screenshot example uses works to get the session’s current user (i.e., the user approving), the Deviation Originator, and then if the person approving is the Deviation originator and 
    closure statement field is null or blank, Agile throws an error and blocks the originator from approving.  The script runs for everyone else but since they (the current user signing) is not the Originator, Agile skips over that part in the script and just lets them approve.  Therefore, this same method can be applied to look at different fields for different users, like say getting their job titles and forcing different actions based off of someone’s job title.  Again, not to undermine good processes and good training, of course.

    • 3860 views
    • 13 answers
    • 0 votes
  • Agile Angel Asked on August 23, 2018 in Agile PLM (v9).

    Swagoto is correct.
    The simplified script would go something like this:

    try {
    IEventInfo req = obj.getPXEventInfo();
    ISignOffEventInfo objectEventInfo = (ISignOffEventInfo)req
    IChange eco = objectEventInfo.getDataObject();

    String important_value = eco.getValue(ChangeConstants.ATT_PAGE_TWO_LIST01)

    if (important_value == null) {
         throw new Exception (“You need to fill out the important_value field on this ECO prior to approving!”)    }

    } catch (Exception ex) {
    throw new AgileDSLException(ex);
    } // end of try catch block

    That should work for you.  Let us know if you need more help.

    • 3860 views
    • 13 answers
    • 0 votes
  • Agile Angel Asked on August 20, 2018 in Agile PLM (v9).

    Doc ID 1121926.1 from the Oracle knowledge zone has a list of all of the Averify scripts.  I didn’t directly find the one you’re referring to but perhaps some of your earlier log files give you hints about what SQL script was ran.  
    Looks like, after seeing Doc ID 1932718.1, your Averify might have been running AGIL-00075061_c1.sql .  There, the simplified version of the SQL script is this:

    SELECT B.id “BOM.ID” 
    FROM   bom B 
    WHERE  B.change_in != 0 
           AND NOT EXISTS (SELECT R.id 
                           FROM   rev R 
                           WHERE  R.change = B.change_in 
                                  AND R.item = B.item) 
    UNION 
    SELECT id 
    FROM   bom 
    WHERE  prior_bom IN (SELECT id 
                         FROM   bom B 
                         WHERE  B.change_in != 0 
                                AND NOT EXISTS (SELECT R.id 
                                                FROM   rev R 
                                                WHERE  R.change = B.change_in 
                                                       AND R.item = B.item)); 

    Somewhere else on the Oracle website I found the Averify Script.zip folder with all of the extended sql scripts.  If you can’t find it and need the one for AGIL-00075061_c1.sql, let me know.  
    Try that.

    • 1786 views
    • 2 answers
    • 0 votes
  • Hi Priyanka,

    You can take basically take most of what you have and test it as a Groovy PX just fine – just the main method and return method will be different on a groovy PX.  I’ve done that to test chunks of script at a time and basically anything written in Java will convert over to Groovy just fine.  You can try exporting as a jar and testing in your test environment as well.  I’ve never got a JOptionPane to work in Groovy script though I’ve never tried on a java PX (can anyone else confirm?).  

    Your script looks ok to me.  I noticed that you’re getting the IChange/Dataobject twice in your script.  Replace line 5 (IDataObject affectedObject = null;) to (IChange affectedObject = null) and you won’t need lines 17 and 18.  Your line <String ITEMLIFE = itemObj.getValue(…> might want to be switched to the row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_LIFECYCLE_PHASE) just to be on the safe side.  Also try IItem itemObj = row.getReferent() as an easy way to get the IItem dataobject on a Change Order affected items table.  

    I can’t really say why you’re not able to get the IEventInfo object info but that’s because I’m way more familiar with how Groovy scripts handle this.  I am confident that your casting issue is because you need to change it to an IChange object instead (IChange obj1 = (IChange) session….).

    Check out Oracle Doc ID 760058.1, Doc ID 885594.1, and Doc ID 742488.1 for more help and step by step guides for deploying Java PXs.

    • 2484 views
    • 2 answers
    • 1 votes
  • And specifically you change your from user in the Java Client -> Admin -> Server Settings -> Database -> Mail From User field.  There is where I changed my email address for Agile Test just for this reason.

    • 1724 views
    • 4 answers
    • 0 votes
  • Agile Angel Asked on August 16, 2018 in Software Development Kit (API).

    I’ve experienced that too.  It’s because your script is triggering when moving statuses and Agile won’t trigger that script until you hit the ‘Finish’ button.
    What I’ve done is gone a workflow back a step, i.e., from Pending to Submitted, then after that Agile will add the reviewers before I go to Review/CCB.  If that doesn’t work for you (like you’re changing values in Submitted status that will affect what users are added), try an Extend Actions menu button, a scheduled event, or update Title Block event, whichever works best for you.

    • 1675 views
    • 1 answers
    • 0 votes
  • Agile Angel Asked on August 9, 2018 in Agile PLM (v9).

    Try user permissions (Approve or Reject) under a workflow with a certain criteria.  If it’s suits you better, you can create a PX that throws an exception (error message) when a user tries to approve or reject something given the criteria or other custom flags (and return a message to the users about why they can’t approve or reject).

    • 1154 views
    • 1 answers
    • 0 votes
  • Agile Angel Asked on August 7, 2018 in Agile PLM (v9).

    Yes, you can use a PX for this.  I created something similar where:

    Event:  Update Table – Parts – Manufacturers Table
    Event Subscriber: Pre, Synchronous, and Stop
    Event Handler:
    //
    try {
    //get statuses
    if (manufacturer_status == “Not Approved” && items_pending_change_to_lifecycle == “Items.Production” {
       throw new Exception (“You can’t add a not approved supplier to this Active part!”)
    }
    } catch (Exception ex) {
    ex.printStackTrace();
    throw new AgileDSLException(ex);
    } // end of try catch block

    something like that.

    • 1231 views
    • 4 answers
    • 0 votes