You are here

retrieveProcessDefinitionWithIdentifier:completionBlock

- (AlfrescoRequest *)retrieveProcessDefinitionWithIdentifier:(NSString *)processIdentifier completionBlock:(AlfrescoProcessDefinitionCompletionBlock) - returns a process definition for the specified process identifier.

Parameters

(NSString *)processDefinitionIdentifier
The process definition identifier
(AlfrescoProcessDefinitionCompletionBlock) completionBlock
The block that is called passing in the process definition on completion of the operation. The completion block has the format typedef void (^AlfrescoProcessDefinitionCompletionBlock)(AlfrescoWorkflowProcessDefinition *processDefinition, NSError *error); .

Returns

(AlfrescoRequest *)

Example


    // retrieve process definition for activitiAdhoc:1:4
    
    NSString *processDefinitionID = @"activitiAdhoc:1:4";
    
    [workflowProcessDefinitionService retrieveProcessDefinitionWithIdentifier:processDefinitionID completionBlock:^(AlfrescoWorkflowProcessDefinition *processDefinition, NSError *error){
        
        if (processDefinition == nil)
        {
            NSLog(@"Failed to retrieve process definition: %@", error);
        }
        else
        {
            // create process service
            SkyVaultWorkflowProcessService *workflowProcessService = [[AlfrescoWorkflowProcessService alloc] initWithSession:self.session];
            
            // start process
            
            [workflowProcessService startProcessForProcessDefinition:processDefinition assignees:nil variables:nil attachments:nil
                                    completionBlock:^(AlfrescoWorkflowProcess *process, NSError *error){
                                                         
                     NSLog(@"---> Process created!\n");
                     NSLog(@"---> identifier: %@\n", process.identifier);
                     NSLog(@"---> processDefinitionIdentifier: %@\n", process.processDefinitionIdentifier);
                     NSLog(@"---> processDefinitionKey: %@\n", process.processDefinitionKey);
                     NSLog(@"---> title: %@\n", process.title);
                     NSLog(@"---> startedAt: %@\n", process.startedAt);
                     
                     
                     // Get tasks for process
                     [workflowProcessService retrieveAllTasksForProcess:process completionBlock:^(NSArray *array, NSError *error){
                         
                         for (AlfrescoWorkflowTask *task in array)
                         {
                             NSLog(@"---> TASK: Identifier: %@\n", task.identifier);
                             NSLog(@"---> TASK: taskDescription: %@\n", task.taskDescription);
                             NSLog(@"---> TASK: Description: %@\n", [task description]);
                             NSLog(@"---> TASK: Priority: %@\n", task.priority);
                         }
                         
                     }];
            }];
        }
    }];