Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By medoman
#788046
im here again
sorry but i have an (upload document) named (bp) in my form... the users negotiate the process through this document and use this field to upload the document many times.... finally and after the supervisor approve the case i need to send the final document (only the last uploaded file) by the email to the project manager to start the project...
User avatar
By amosbatto
#788064
Adapting this example, you can use this code:
Code: Select all
$inputDocId = '8145302265845d4b6db1721089633669'; //set to Input Document ID
$caseId = @@APPLICATION;
//find the UID and version for the uploaded Input Document file(s):
$query = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT
   WHERE APP_UID='$caseId' AND DOC_UID='$inputDocId' AND
   APP_DOC_STATUS='ACTIVE' ORDER BY APP_DOC_CREATE_DATE DESC";
$aFiles = executeQuery($query);

if (is_array($aFiles) and count($aFiles) > 0) {
   $aAttached = array();
 
      $d = new AppDocument();
      $aDoc = $d->Load($aFiles[1]['APP_DOC_UID'], $aFiles[1]['DOC_VERSION']);
      $filename = $aDoc['APP_DOC_FILENAME'];
      $ext = pathinfo($filename, PATHINFO_EXTENSION);
      $filePath = PATH_DOCUMENT . G::getPathFromUID($caseId) . PATH_SEP .
         $aFiles[1]['APP_DOC_UID'] .'_'. $aFiles[1]['DOC_VERSION'] .'.'. $ext;
      $aAttached = PMFAddAttachmentToArray($aAttached, $filename, $filePath);
   
   //get users who have participated in case:
   $c = new Cases();
   $aUsers = $c->getUsersParticipatedInCase(@@APPLICATION);
   $to = '';
   foreach ($aUsers['array'] as $userUID => $userInfo) {
      $to = (empty($to) ? '' : ', ') . $userInfo['USR_EMAIL'];
   }
   PMFSendMessage($caseId, 'admin@example.com', $to, '', '',
      'Invoices for case #'.@@APP_NUMBER, 'invoiceTemplate.html', array(), $aAttached);
}
User avatar
By amosbatto
#788086
If you need the email address of the manager of the current logged-in user:
Code: Select all
$managerEmail = '';
$aUser = PMFInformationUser(@@USER_LOGGED);
$managerId = $aUser['reportsto'];
if ($managerId) {
   $aManager = PMFInformationUser($managerId);
   $managerEmail = $aManager['mail'];
}

This only works if the current user is a member of a department with a manager.

Being the best in the started business is the obje[…]

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]