如何讀取正在工作流程中的物件,我們先建置一個工作流程,並且加入一支程式。
新增一個空白的Workflow
新增一個Method到Released節點中
//從Activity ID 反查詢表單ID
Innovator inn = this.getInnovator();
string actId = this.getID();//activity id
Item wflItem = this.newItem("Workflow","get");
wflItem.setAttribute("select","source_id,source_type");
Item wflProc = wflItem.createRelatedItem("Workflow Process","get");
wflProc.setAttribute("select","name");
Item wflProcAct = wflProc.createRelationship("Workflow Process Activity","get");
wflProcAct.setAttribute("select","related_id");
wflProcAct.setProperty("related_id",actId);
wflItem = wflItem.apply();
string result="id="+wflItem.getProperty("source_id","")+"\r\n"; //表單ID
result+="type="+wflItem.getProperty("source_type","");//表單ItemType ID
return inn.newError(result);
return this;
加入到 Work Order
進入簽審清單
簽審至Released,顯示出錯誤訊息
程式一樣是組成AML並apply給資料庫讀取,apply前的內容如下
<Item isNew="1" isTemp="1" type="Workflow" action="get" select="source_id,source_type">
<related_id>
<Item isNew="1" isTemp="1" type="Workflow Process" action="get" select="name">
<Relationships>
<Item isNew="1" isTemp="1" type="Workflow Process Activity" action="get" select="related_id">
<related_id>F814929E315A48A19512C87A9EE10841</related_id>
</Item>
</Relationships>
</Item>
</related_id>
</Item>
apply後結果
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<Result>
<Item type="Workflow" typeId="9E212D4ED3C64493B631EE15D0A62AF7" id="AC29F6D04C9A45179D974A67A217FCB1">
<id keyed_name="AC29F6D04C9A45179D974A67A217FCB1" type="Workflow">AC29F6D04C9A45179D974A67A217FCB1</id>
<source_id>C0EE3688D1C140DA886DC7AB8CEEA9CF</source_id>
<source_type keyed_name="Work Order" type="ItemType" name="Work Order">4C2C774E061048DFB7CB1BC08D7B73A6</source_type>
</Item>
</Result>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>