Created
March 1, 2016 02:53
-
-
Save tyoshikawa1106/b6d6ef0d6abad9ac4b62 to your computer and use it in GitHub Desktop.
承認履歴情報周りの取得方法サンプルクエリ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProcessInstance p = [ | |
SELECT | |
Id | |
,CompletedDate | |
,LastActorId | |
,ProcessDefinitionId | |
,Status | |
,TargetObjectId | |
,(SELECT Id,ActorId,Comments,IsPending,OriginalActorId,ProcessInstanceId,ProcessNodeId,StepStatus,TargetObjectId FROM StepsAndWorkitems) | |
FROM | |
ProcessInstance | |
LIMIT 1 | |
]; | |
// ProcessInstanceの確認 | |
System.debug('-- ProcessInstance --'); | |
System.debug(p); | |
// ProcessInstanceHistoryの確認 | |
System.debug('-- ProcessInstanceHistory --'); | |
for (ProcessInstanceHistory sw : p.StepsAndWorkitems) { | |
System.debug(sw); | |
} | |
// ProcessNodeId取得 | |
Set<String> nodeIds = new Set<String>(); | |
for (ProcessInstanceHistory sw : p.StepsAndWorkitems) { | |
nodeIds.add(sw.ProcessNodeId); | |
} | |
List<ProcessInstanceNode> processNodes = [ | |
SELECT | |
Id | |
,CompletedDate | |
,LastActorId | |
,NodeStatus | |
,ProcessInstanceId | |
,ProcessNodeId | |
,ProcessNodeName | |
FROM | |
ProcessInstanceNode | |
WHERE | |
ProcessNodeId IN: nodeIds | |
]; | |
System.debug('-- ProcessInstanceNode --'); | |
System.debug(processNodes); | |
// 参考サイト | |
// https://developer.salesforce.com/docs/atlas.ja-jp.198.0.object_reference.meta/object_reference/sforce_api_objects_processinstance.htm?search_text=ProcessInstance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment