Creating an Operation in Custom Class

Below is the example of creating a new operation in a custom class. The request contains the moniker of opened custom class container instance and the pattern that specifies whether a new operation should be created, and a class, in which the operation is to be created. The response contains updated information about the custom class to be changed.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetCustomExtender xmlns="http://www.fsight.ru/PP.SOM.Som">
<tCustomExtender xmlns="">
  <id>JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI</id>
  </tCustomExtender>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <parsOwnDefVals>true</parsOwnDefVals>
  <classes>Change</classes>
<customClass>
  <smallImage>true</smallImage>
  <largeImage>true</largeImage>
  <CustomOperations>Add</CustomOperations>
  </customClass>
  </pattern>
<meta>
<classes>
<its>
<it>
  <k>33</k>
<operations>
<its>
<it>
  <k>-1</k>
  </it>
  </its>
  </operations>
  </it>
  </its>
  </classes>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <parsOwnDefVals>true</parsOwnDefVals>
  <classes>Get</classes>
<classesFilter>
<keys>
  <i>33</i>
  </keys>
  </classesFilter>
<customClass>
  <smallImage>true</smallImage>
  <largeImage>true</largeImage>
  <CustomOperations>Get</CustomOperations>
  </customClass>
  </metaGet>
  </tArg>
  </SetCustomExtender>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetCustomExtenderResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="13" hf="0">
  <i>OBJ52</i>
  <n>System class additions</n>
  <k>52</k>
  <c>5889</c>
  <p>0</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
<classes>
<its>
<it ic="0">
  <k>33</k>
  <id>OBJ417</id>
  <n>CustomClass</n>
  <vis>1</vis>
  <implURL />
<standardOperations>
<its>
<it>
  <k>0</k>
  <id>OPEN</id>
  <n>Open</n>
  <vis>1</vis>
  </it>
<it>
  <k>1</k>
  <id>OPENWITHPARAMS</id>
  <n>Open with parameters</n>
  <vis>1</vis>
  </it>
<it>
  <k>2</k>
  <id>EDIT</id>
  <n>Edit</n>
  <vis>1</vis>
  </it>
<it>
  <k>3</k>
  <id>DELETE</id>
  <n>Delete</n>
  <vis>1</vis>
  </it>
<it>
  <k>4</k>
  <id>PASTE</id>
  <n>Paste</n>
  <vis>1</vis>
  </it>
  </its>
  </standardOperations>
<operations>
<its>
<it>
  <k>1</k>
  <id>CLS33OP1</id>
  <n>Operation 1</n>
  <vis>1</vis>
  </it>
  </its>
  </operations>
  <c>2168577</c>
  <h>0</h>
  <implClass />
  <description />
  </it>
  </its>
  </classes>
  </meta>
  </SetCustomExtenderResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetCustomExtender" :
{
"tCustomExtender" :
{
"id" : "JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"parsOwnDefVals" : "true",
"classes" : "Change",
"customClass" :
{
"smallImage" : "true",
"largeImage" : "true",
"CustomOperations" : "Add"
}
},
"meta" :
{
"classes" :
{
"its" :
{
"it" :
[
{
"k" : "33",
"operations" :
{
"its" :
{
"it" :
[
{
"k" : "-1"
}
]
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"parsOwnDefVals" : "true",
"classes" : "Get",
"classesFilter" :
{
"keys" :
{
"i" : "33"
}
},
"customClass" :
{
"smallImage" : "true",
"largeImage" : "true",
"CustomOperations" : "Get"
}
}
}
}
}

JSON response:

{
"SetCustomExtenderResult" :
{
"id" :
{
"id" : "JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "13",
"@hf" : "0",
"i" : "OBJ52",
"n" : "System class additions",
"k" : "52",
"c" : "5889",
"p" : "0",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"classes" :
{
"its" :
{
"it" :
[
{
"@ic" : "0",
"k" : "33",
"id" : "OBJ417",
"n" : "CustomClass",
"vis" : "1",
"implURL" : "",
"standardOperations" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "OPEN",
"n" : "Open",
"vis" : "1"
},
{
"k" : "1",
"id" : "OPENWITHPARAMS",
"n" : "Open with parameters",
"vis" : "1"
},
{
"k" : "2",
"id" : "EDIT",
"n" : "Edit",
"vis" : "1"
},
{
"k" : "3",
"id" : "DELETE",
"n" : "Delete",
"vis" : "1"
},
{
"k" : "4",
"id" : "PASTE",
"n" : "Paste",
"vis" : "1"
}
]
}
},
"operations" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "CLS33OP1",
"n" : "Operation 1",
"vis" : "1"
}
]
}
},
"c" : "2168577",
"h" : "0",
"implClass" : "",
"description" : ""
}
]
}
}
}
}
}
public static SetCustomExtenderResult AddOperationInCustomClass(string moniker, CustomClass changedClass)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetCustomExtender()
{
tArg = new SetCustomExtenderArg()
{
pattern = new CustomExtenderMdPattern()
{
classes = ListOperation.Change,
customClass = new CustomClassPattern()
{
CustomOperations = ListOperation.Add
}
},
meta = new CustomExtenderMd()
{
classes = new CustomClasses()
{
its = new CustomClass[]
{
new CustomClass()
{
k = changedClass.k,
operations = new CustomOperations()
{
its = new CustomOperation[]
{
new CustomOperation() { k = uint.MaxValue }
}
}
}
}
}
},
metaGet = new CustomExtenderMdPattern()
{
classes = ListOperation.Get,
classesFilter = new CustomClassesFilter()
{
keys = new int[]
{
(int)changedClass.k
}
},
customClass = new CustomClassPattern()
{
CustomOperations = ListOperation.Get
}
}
},
tCustomExtender = new CustomObId() { id = moniker }
};
// Create a custom class operation
var tResult = somClient.SetCustomExtender(tSet);
return tResult;
}

See also:

SetCustomExtender: Operation