Matt Paulhus's Profile
Agile Angel
1051
Points

Questions
25

Answers
144

  • Agile Angel Asked on November 1, 2017 in Agile PLM (v9).

    Agile does not automatically move a Deviation to expired.  Sometimes this is for the better though, such as if your company requires some sort of closure statement or final review before moving to expired.  I’ve done a couple of things in the past with this one:  create a search for Deviations where Expiration Date <= $TODAY (and work manually off of that search), or customize your own SDK script with APIs where Agile automatically change status to Expired at expiration date.

    There’s one or two other posts about this called “Notifications from Agile” and ” Putting current date through IQuery” that may help you too.  

    • 2761 views
    • 3 answers
    • 0 votes
  • Agile Angel Asked on October 27, 2017 in Agile PLM (v9).

    To answer my own question for anyone in the future, you would need to tap into the ACCOUNT_LOCKOUT_NOTIFY table.  Not sure if this would be a quick scheduled event, like a PX, that looks for anyone locked out. I’m at a new company now where this is no longer an issue.

    Available columns within this database table include:  ID, SEND_USER_ID, NOTIFY_USER_ID, USER_ID, TEMPLATE_ID, and RESET_PASSWORD

    This answer accepted by Matt Paulhus. on April 20, 2024 Earned 15 points.

    • 1484 views
    • 1 answers
    • 0 votes
  • Agile Angel Asked on October 26, 2017 in Agile PLM (v9).

    It’s because you haven’t imported that specific library.  Add import com.agile.api.StatusConstants to the top import section and try that.  
    You have more import statements than you need, by the way.  The main ones you will need in your script moving forward will be:

    import com.agile.agileDSL.ScriptObj.IBaseScriptObj
    import com.agile.api.ChangeConstants;
    import com.agile.api.CommonConstants;
    import com.agile.api.IAgileSession
    import com.agile.api.IChange
    import com.agile.api.IRoutable
    import com.agile.api.StatusConstants;

    Let me know how it works because I highly suspect that it will not.  You used the word ‘change’ in your script and there’s a difference in the behind-the-curtain logic in what you’re doing (IBaseScriptObj versus IChange dataobject).  Some methods like .logMonitor use the IBaseScriptObj while others, like .getStatus() use the IChange dataobject and SDK session. For an example, see the “Add Document to New Part” script example in the Agile admin manual and how it uses the words ‘obj’, ‘session’, ‘part’, and ‘doc’.  It’s good that you’re learning.

    • 4152 views
    • 15 answers
    • 0 votes
  • Agile Angel Asked on October 26, 2017 in Agile PLM (v9).

    What Event trigger are you using, by the way?

    • 4152 views
    • 15 answers
    • 0 votes
  • Agile Angel Asked on October 26, 2017 in Agile PLM (v9).

    Yep, you’re answer is not as simply as you hope and you’re not as close as you first thought.  That’s ok – I remember thinking I was close but then really wasn’t at all.

    A few things to consider:

    First – your .getStates method is correct but it’s working off of the wrong type of data.  As far as Agile is concerned, it’s trying to work off of an IBaseScriptObj called “change”, but that data isn’t what you need.  You need an IChange dataobject instead.  There is a better way to get the data object, but for now, do this.  Add these lines to the script and change the word “change” in the line starting with ‘void’ to this:  

         void invokeScript(IBaseScriptObj obj) {
         IAgileSession session = obj.getAgileSDKSession();
         String econumber = obj.getValueByAttId(ChangeConstants.ATT_COVER_PAGE_NUMBER);
         IChange change = (IChange) session.getObject(ChangeConstants.CLASS_ECO, econumber)

    You’ll need this line also early in the script after the void line:
    IAgileSession session = obj.getAgileSDKSession();

    Here we told Agile to run the invokeScript method off of the inherit object, then create our own mini-SDK session, get the object’s number, and then get the IChange change dataobject to do stuff with.  

    These four lines in your script aren’t doing anything important, if you want to remove them.  
    String Attribute = AttributeObj == null? “” : AttributeObj.toString()
    change.logMonitor(AttributeObj) 
    Object Status = change.getValueByAttId(ChangeConstants.ATT_COVER_PAGE_STATUS)
    change.logMonitor(Status)

    (change.logMonitor() would hence need to be changed to obj.logMonitor() to work)

    Note again in this new version of your script how the words ‘obj’, ‘session’, and ‘change’ all link together.

    • 4152 views
    • 15 answers
    • 0 votes
  • Agile Angel Asked on October 26, 2017 in Agile PLM (v9).

    Oh, you don’t have to give up.  Only give up if you don’t think learning code will ever be part of your professional development.  I am not a coder either and just started teaching myself back in May.  It takes a tremendous amount of hours though and tons of trial and error.  It’s totally acceptable though to spend your working hours on other projects important for you and your business while budgeting a few dollars getting future process extensions from Xavor, GoEngineer, or another consultant.  

    This should work for your code but nonetheless does require time testing, upgrading, deploying, etc.

    import com.agile.agileDSL.ScriptObj.IBaseScriptObj
    import com.agile.api.ChangeConstants;
    import com.agile.api.CommonConstants;
    import com.agile.api.IAgileSession
    import com.agile.api.IChange
    import com.agile.api.IRoutable
    import com.agile.api.StatusConstants;

    void invokeScript(IBaseScriptObj obj) {
    IAgileSession session = obj.getAgileSDKSession();

    try {
    String econumber = obj.getValueByAttId(ChangeConstants.ATT_COVER_PAGE_NUMBER);
    IChange change = (IChange) session.getObject(ChangeConstants.CLASS_ECO, econumber)
    String AttributeObj = obj.getValueByAttId(CommonConstants.ATT_PAGE_THREE_LIST01)

    if (AttributeObj == “Accepted”) {
    change.changeStatus(change.getWorkflow().getStates(StatusConstants.TYPE_RELEASED)[0], false,””, false, false, null, null, null, null, false)
    }

    else if (AttributeObj == “Denied”) {
    change.changeStatus(change.getWorkflow().getStates(StatusConstants.TYPE_CANCEL)[0], false,””, false, false, null, null, null, null, false)

    }
    } catch (Exception e) {
    obj.logMonitor(e.getMessage())
    }
    }

    • 4152 views
    • 15 answers
    • 0 votes
  • Agile Angel Asked on October 26, 2017 in Agile PLM (v9).

    You can google it for more info, but a try/catch block basically tries to execute code, and if there’s an issue, catches the error so you can do some other action instead of processing the code within the try block.  Say you had to update A, B, C but Agile failed to update C…well A and B would have already been updated if you didn’t have a try block for all three.

    • 4152 views
    • 15 answers
    • 0 votes
  • Agile Angel Asked on October 25, 2017 in Agile PLM (v9).

    Oh, true – I was assuming that you were asking about API/SDK scripting queries.  You definitely can add the BOM item number on an Advanced Search.

    • 1392 views
    • 3 answers
    • 0 votes
  • Agile Angel Asked on October 25, 2017 in Agile PLM (v9).

    Workflow can’t be set by .setAttributeByValueId() but by the IRoutable .changeStatus() method Arif mentioned.  Your groovy script will be something like:

    if (change.getValue(ChangeConstants.ATT_PAGE_TWO_LIST01) == “Accepted” ) {
            change.changeStatus()     //fill in with the default inputs like Arif used above telling Agile to change the workflow to Released
    }
    else if (change.getValue(ChangeConstants.ATT_PAGE_TWO_LIST01) == “Denied” ) {
           change.changeStatus()      //sends the ECO to cancelled, just again make sure you fill in the correct inputs lest you get a “no signature of method” exception 
    }

    There’s a bunch of ways to configure this.  Does this help?  
    (I also recommend not using a Change Request attribute of ‘Denied’ as a Cancelled status type, though.  Use Approved/Disapproved as both Complete types.  Just a thought though).

    • 4152 views
    • 15 answers
    • 0 votes
  • It’s doable – I was working on that same thing today.  
    Use the SIGNOFF table and you’ll need to join the CHANGE_NUMBER column of the CHANGE table with the ID of the CHANGE_ID of the SIGNOFF to be able to easily specify the ECO number.  Also note that SIGNOFF_STATUS is a column where 0 = they didn’t sign, 2 = they did sign, and 4 = they were an observer. 

    Available columns include:
    CHANGE_ID, CREATED, FLAGS, HISTORY_ID, ID, JOB_FUNC, LAST_UPD, PROCESS_ID, REQUIRED, SIGNOFF_HISTORYID, SIGNOFF_STATUS, USER_ASSIGNED, USER_NAME_ASSIGNED, USER_NAME_SIGNED, USER_SIGNED, VERSION

    • 1791 views
    • 1 answers
    • 0 votes