Showing posts with label lapi. Show all posts
Showing posts with label lapi. Show all posts

Tuesday, April 6, 2010

How to update a boolean, yes/no, true/false attribute with LAPI

1 comments
Below is sample code in C# on updating a physical item attribute (custom system attributes in the Specifics tab of a physical object). You can use the same logic to update a regular category attribute that is boolean based.

The most important line is the  request.add("mtField_PrintNewLabel", "on");

Basically, use "on" for true, "off" for false. The "mtField_PrintNewLabel" is the name of the custom physical object attribute. It's mtField_Name-of-the-field.

For a category-attribute, you would use the update category functions and call the attribute name with the "on"/"off" value being passed.  


***I will post more examples of updating category/attributes, physical items (records management), and easy Livelink session establishment.

void doIt(int nodeID)
        {
            LLSession session = null;
            session = new LLSession("opentext.server.blah.com",
                                    2099,
                                    "",
                                    "adminloginacct",
                                    "adminpw");

            session.ImpersonateUser("yomama");


            LAPI_DOCUMENTS doc = new LAPI_DOCUMENTS(session);

            LLValue request = (new LLValue()).setAssocNotSet();

            request.add("objAction", "info2");
            request.add("selectedMedia",1235465 );
            request.add("poLocation", "CRC - ABC");
            request.add("mtField_Volume", "Vol10");
            request.add("mtField_Temporary", "No");
            request.add("mtField_FileType", "");           
            request.add("mtField_PrintNewLabel", "on");

            LLValue myEntValues = new LLValue();
            int volID = 0;
            if (doc.AccessEnterpriseWS(myEntValues) == 0)
            {
                volID = myEntValues.toInteger("VolumeID");
            }

            int status = 0;

            status = doc.UpdateObjectInfo(volID, nodeID, request);


            if (status != 0)
            {
                string errMsg = string.Format("Problem: {0} | {1} | {2} | {3}", session.getApiError(), session.getErrMsg(), session.getStatus(), session.getStatusMessage());
                Response.Write(errMsg);
            }
            else
            {
                Response.Write("Something got updated");
            }

        }

Tuesday, March 9, 2010

Error: Unique constraint on dtree, LAPI add object, 101107

0 comments
Environment: Livelink 9.7.1, .NET 3.5, Oracle 10, ADN module, heavy category/attributes
Problem: Multithreaded LAPI app loads several documents into Livelink and creates new folder structures, permissions, RM Classifications, and categories. Once in a while, we run into this error on the Livelink server side: Oracle error: (1) --> ORA-00001: unique constraint (LINK_OWNER.ADNIDS_INDEX1) violated

The LAPI error is CreateObjectEx Failed. Message=Error adding categories to node errMsg=Error saving generated number. Status=101107 (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
LapiException: CreateObjectEx Failed. Message=Error adding categories to node errMsg=Error saving generated number. Status=101107

Theories:
  • ADN is blowing up again. 
  • The LAPI port is getting overloaded.
  • LAPI sucks.
  • The database is being overwhelmed by multiple transactions from multiple users (adding one object to Livelink is usually about 100-200 various transactions, so do the math if there are 100+ users).

Wednesday, February 24, 2010

LAPI Error 107404

0 comments
Session Status=107404
Error=Error setting the category or attributes for this node. Error saving generated number.
Happening When=Updating multiple documents with latest attribute values.

The "Error saving generated number" points to an Automatic Document Numbering module specific error... but who knows. More research to follow....

Thursday, February 18, 2010

LAPI Error 101107

0 comments
LapiException: CreateObjectEx Failed. Message=Error adding categories to node errMsg=Error saving generated number. Status=101107

Scenario: Bunch of categories need to be applied to a newly created folder structure and sub objects. I was trying to add a document into Livelink via LAPI. If the folder structure for where document goes does not exist, then the LAPI app creates it with the correct categories, attributes, permissions, RM Classifications, etc... However, if the structure exists, even though the category may have been applied incorrectly, then the app will just load the document into the folder structure.

Potential cause: I'm still looking into since there are so many moving parts and factors involved with this enterprise solution.... for loading documents non-natively (if that's a word) into Livelink. (DAMN architects)
What I think is happening is that -
  • The category DNE at the expected parent level.
  • The attributes were not populated correctly.
  • ADN (automatic document numbering) had an issue
I strongly believe it has something to do with ADN because I have found issues with SQL Injections. You attempt to load a document with reserved SQL words like UNION and JOIN and ADN freaks out. Special characters like apostrophe mess it up too. We have patched ADN with a quick fix from the vendor but still run into this 101107 error. It's like Livelink is failing during the database writes into ADN along with the external file store and the attribute tables. WTF....

What a pain in the ass to resolve. Logging on the Livelink is so process intensive.

Wednesday, February 17, 2010

LAPI Connection Issues

1 comments
I've been running into sporadic issues with an enterprise app that hits Livelink constantly through LAPI. The following are some articles I found. None of them fixed my issue though because we've actually attempted the resolutions two years ago to fix ANOTHER LAPI connection issue. F%$K!!!

Article Number: 3500936 - Why do I get LAPI connectivity issues intermittently?
  • Running massive amounts LAPI transactions result in "Could not access server" error.
Article Number: 15090633 - LAPI - GetObjectAttributesEx Function Executes Increasingly Slowly When Called Repeatedly
  • Repetitive usage of the function results in degrading performance.
Article Number: 3496785 - Keep Livelink Socket Backlog In Mind When Creating Multi-Threaded LAPI programs
  • LAPI calls randomly fail in Multi-threaded applications if the number of application threads are greater than the number of Livelink server threads
Article Number: 3501616 - Getting sporadic LAPI errors (Pooling LLSession objects)
  • There is no apparent advantage to pooling LLSession objects