Tuesday, April 6, 2010

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

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");
            }

        }

1 comments:

Unknown said...

The King Casino Company - Ventureberg
It was born in 1934. The Company offers ventureberg.com/ luxury hotels, If you don't have a poker room in your house, https://octcasino.com/ then you'll find a poker room gri-go.com in deccasino the https://febcasino.com/review/merit-casino/

Post a Comment