BPM, Workflow, and Case

 View Only
  • 1.  Why getting error when calling tw.system.org.getAllUsers() ?

    Posted Tue February 21, 2023 06:04 AM

    Hi All,

    We have a BAW environment with a federated user repo with the file based realm and one AD connection.

    When we call the tw.system.org.getAllUsers() function within a service, we get this error:

    Internal Script error: [TeamworksException name='<JSScript>', message='getAllUsers(...) Error: PreparedStatementCallback; SQL [insert into LSW_USR_XREF (USER_ID,USER_NAME,FULL_NAME,PROVIDER,USER_STATE,LAST_STATE_MODIFIED) values (?,?,?,?,?,?)]; Error for batch element #1: DB2 SQL Error: SQLCODE=-545, SQLSTATE=23513, SQLERRMC=DB2INST1.LSW_USR_XREF.PROVIDER, DRIVER=4.27.25; nested exception is com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: Error for batch element #1: DB2 SQL Error: SQLCODE=-545, SQLSTATE=23513, SQLERRMC=DB2INST1.LSW_USR_XREF.PROVIDER, DRIVER=4.27.25'

    What's wrong? What kind of constraint could be violated and why? How to solve this?
    Bonus question: why do BAW insert users into a table when we query the list of users?

    We want to set several user attributes defined in BAW (like Task Email Address, Title) and our BAW application (like DepartmentCode), and this is why we need the list of users. Using the login name of users we can do queries in the core system to get these attributes.

    In global this functon call works, but at one of our client produces this error (v22, DEV environment).

    Any help appreciated,
    Thx,



    ------------------------------
    Laszlo
    ------------------------------


  • 2.  RE: Why getting error when calling tw.system.org.getAllUsers() ?

    Posted Wed February 22, 2023 01:59 AM
    Edited by Akash Gupta Wed February 22, 2023 02:03 AM

    Probably there is a duplicate userName in one your repositories. I assume that internally product collects  the users from all different repos and store it one single table.

    There are unique checks for the below combination. You need to check which one is failing for your case. If you find the duplicate user then you need to delete that user from BPM (you can use Process admin).

    1. USER_NAME, PROVIDER
    2. PROVIDER, USER_ID
    3. USER_ID, USER_NAME



    ------------------------------
    Akash Gupta
    ------------------------------



  • 3.  RE: Why getting error when calling tw.system.org.getAllUsers() ?

    Posted Wed February 22, 2023 02:09 AM

    Hi Akash,

    There are no duplicates. In the file-based and in the AD realms there are different users only. That's why we don't understand this.

    But after changing the query from tw.system.org.getAllUsers() to tw.system.org.findRoleByName("tw_allusers").allUsers, we have no problems, we get back all BAW users.

    Anyway, it seems that the problem solved.



    ------------------------------
    Laszlo
    ------------------------------