Announcement

Collapse
No announcement yet.

Log Audit entry in target entity stream for BPM user task resolution

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rabii
    replied
    I had the same problem earlier this month but managed to sort it out. i have two task users in my flowchart and wanted to return the resolution note once a task user is resolved, be low my diagram: the solution is use a Call Activity which will call another Flowchart for User Task Process, this flowchart will return the resolution note and store it in a variable. Please see attached screenshot.

    Please note that when you use "Created: Process User Task" it will not work for all User Task, you need to reference each with correct created task user id.

    It is working for me so i hope this will help.

    Good luck
    Attached Files

    Leave a comment:


  • hi-ko
    replied
    I need to reference these variables
    * to store the outcome of any (of many) review user tasks on a new stream (note) on the target entity. The users need to see the feedback on the entity itself.
    * in an email template to send an email after the last review user task has been completed to give the responsible person the info that there is feedback from a user review task.

    I moved my comment from https://forum.espocrm.com/forum/gene...d-message-task to this thread since it has nothing to do with the email template itself:

    I was already aware of the email sample but the attributes from the user task needs to be stored in separate variables anyhow to have them available in the template applied in a later step. There is no option to execute a formula or script after the user task has been completed to copy the outcome into variables. The sub process seems to solve this issue but there seems to be a bug:
    When creating a sub process I could choose as target "Created: Process User Task", "Created: Process User Task #1", "Created: Process User Task #2".
    When I choose "Created: Process User Task #1" the sub process will always fail but it works using the generic one "Created: Process User Task". I will check how that works when the 2nd review task has been executed if I get then the attributes from the second user task or if this is returning still the attributes from the first one.

    yuri : Could you please confirm this is a bug or guide me to the right direction?

    Leave a comment:


  • emillod
    replied
    You're trying to add those variables to a NOTE? Or to email template?

    Leave a comment:


  • hi-ko
    replied
    When you say BPM you mean a workflow, right? That would not allow to store the user task's resolutionNote into a process variable which I need for the email template.
    So instead of using the script task to create the note directly in the main flow I now try to do this step in a new sub process switching the target entity to the user task but that subprocess is driving me nuts. Anything I do in that subprocess (s. screenshot) is resulting in a failure.
    The script task only contains:
    Code:
    $resolution1 = resolution;
    $resolutionNote1 = resolutionNote;
    $modifiedByName1 = modifiedByName;
    and in the espo log I see:
    Code:
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":364} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":371} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":381} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":392} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":394} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: 0 {"code":8,"message":"Uninitialized string offset: 0","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":402} []
    [2021-07-29 07:46:39] NOTICE: E_NOTICE: Uninitialized string offset: -1 {"code":8,"message":"Uninitialized string offset: -1","file":"/var/www/html/espocrm/application/Espo/Core/Formula/Parser.php","line":437} []
    that whole BPMN thing seems to need some love ...

    Leave a comment:


  • emillod
    replied
    In this case i think you have two options.
    1. You can create BPM for UserTasks entity and there put formula which will create note and just use variable from target record.
    2. If you want to create note only for specific entity, you can add formula which create entity in flowchart which create UserTask. Thanks to that you can add note as response to specific decision. And there you can use note from Created UserTask. I don't know how to post resolution to a variable, but i think it's doable.

    The easiest way would be to just create note through BPM for UserTask entity.

    Leave a comment:


  • hi-ko
    replied
    If I now want to add also the process user task's "resolutionNote" into the new created (stream) Note I can't figure out how to access that field within the script task.
    In a condition for a gateway I can access "Created: Process User Task 'Reviewer #1'.Resolution Note" but how to get that in a script task?

    Leave a comment:


  • hi-ko
    replied
    thanks emillod ! Using a script works now as expected. I endet up now with a script task containing:
    Code:
    $note1 = record\create('Note',
    'createdById', '1',
    'parentId', entity\attribute('id'),
    'parentType', 'DocumentRevision',
    'post', string\concatenate('Document has been reviewed by ', env\userAttribute('name')),
    'type', 'Post'
    );
    Maybe I will try to use other note type like 'Status' to also link to the process user task but for this I need to figure out the required object structure in the data field.

    strange thing is that I don't get any debug output in the log although I set log level to NOTICE.

    Leave a comment:


  • emillod
    replied
    Okay! I've managed to do that even faster than i thought
    Here you have formula:
    https://dubas.pro/c/?34d4fdac305fa35...yLNBtmB3DUV8LK

    Leave a comment:


  • emillod
    replied
    Let me check that for you. I'll try to do it through BPM first. I don't know if i have time for this tomorrow, but for sure tomorrow i should find time. I'll let you know.

    Leave a comment:


  • hi-ko
    replied
    In the log I don't see anything from that task step. I will increase the loglevel and check again.
    When you say "hook" you mean php? Unfortunately i'm not a php coder and it would bypass the concept of bpmn (having not all the logic in the bpmn definition).
    I use hooks for some entity property population but did not see yet the use case in BPM

    Maybe you can help me to create the same in a script task, which may be easier to debug?

    Leave a comment:


  • emillod
    replied
    It's look okay. Did you received any error? You can try also to use formula for that. I would do that through hook, but it's me.

    Leave a comment:


  • Log Audit entry in target entity stream for BPM user task resolution

    When a user resolves an assigned process user task I would like to create an audit entry in the stream of the target entry similar to:
    "{{modifiedBy}} solved process task {{name}} as {{Resolution}} with {{Resolution Note}}"

    I tried within a BPMN task to create a new entity (s. screenshot). Is this the correct way to go (s. screenshot) or do I need to create a script task instead and poplulate new variables before? In case this should be done within a script task, could someone give me an example please?

    Thanks in advance
Working...
X