Below is the example of using the OpenCustomOb operation for opening a custom class object. The request contains moniker of repository object. The response contains moniker of the object instance opened for edit.
{ "OpenCustomOb" : { "tOb" : { "id" : "S1!M!38194" }, "tArg" : { "openForEdit" : "true", "metaGet" : { "obInst" : "true", "data" : "true" } } } }
{ "OpenCustomObResult" : { "id" : { "id" : "S1!M!S!T1" }, "meta" : { "obInst" : { "obDesc" : { "@fullUrl" : "\/", "@isShortcut" : "0", "@isLink" : "0", "i" : "CUST_OBJ", "n" : "Data handler", "k" : "38194", "c" : "71425", "p" : "38193", "h" : "0", "isPermanent" : "1", "isTemp" : "0" } }, "dirty" : "0", "data" : { "refs" : { "its" : "" }, "content" : "" } } } }
The OpenCustomObject function specified below opens the custom class object for edit. The repository connection moniker and object identifier are sent as input parameters. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example. The result of the operation is the result of the function.
public static OpenCustomObResult OpenCustomObject(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenCustomOb()
{
tArg = new OpenCustomObArg()
{
openForEdit = true,
metaGet = new CustomObMdPattern()
{
data = true
}
},
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open custom class object
var tResult = somClient.OpenCustomOb(tOpen);
return tResult;
}
See also: