new comment doesnt trigger rest api rule

Hello,

I have a REST rule in the request module that runs after applying changes.

It runs as expected if I update anything in the ticket and then save.

 

But if i add a comment, then save it doesnt trigger this rule.

I even made a separate rule to fill in a field but that didnt work either...

comment rule.png

I tried

${current_update.Comments.NewValue != ''}

${current_update.Comments.ischanged}

but no comment will trigger the rest.

 

does anyone have any ideas or workarounds?

  • Hello,

    Comments is a complex field, I wouldn't use a check on empty string. With that said, ${current_update.Comments.IsChanged}, should tell you if the field has changed.

    Are you sure the comment has changed as part of the transaction? I suggest turning on the workflow debugger and checking if the conditions evaluated as expected.

    Also, the comments_added function returns a list of comments added in the last update, if you are storing the comment itself in a string field, you should extract the comment body, not trying to assign the entire comment "blob".

    Best regards,

    Brindusa

  • Hi Brindusa,

     

    Thanks for the reply,

    My intent with the storing comments in a string was to test that current_update.Comments.IsChanged was working as expected.

    Since the field was being updated, I believe that function to be working as expected.

     

    After using the debug I did find an error with the execution.

    It evaluates my conditions correct and outputs

            Finished executing action Condition Evaluation with result: true

     

    And then it start executing my

            Started executing action Business Rule Parameters Evaluation with input: {uriSuffix=/sm, headers=[application/json], opbEndPointId=3e415b8df0a1e783786eea9d$$Docker - POC, payloadType=JSON, webMethod=POST, taskPrefix=Case Exchange Output:, opbAgentId=b25e0528478a49a9dc0c1c85, outputFieldName=Comments, credentialsId=112771, body=${concat('{"Operation": "Update","RecordType": "',entity.Type_c,'","RecordId": "',entity.Id,'","SMId": "',entity.Smticket_c,'","TenantId": "88888888","TenantBaseURL": "https://us1-smax.saas.microfocus.com","DispatchedRecordId": "',entity.DispatchedRecord_c,'"}' )}}
     

     

    after it runs/tries it spits out this error

                    Error ! can't find final expression result
            Finished executing action Business Rule Parameters Evaluation with result: {uriSuffix=/sm, headers=[application/json], opbEndPointId=3e415b8df0a1e783786eea9d$$Docker - POC, payloadType=JSON, webMethod=POST, taskPrefix=Case Exchange Output:, opbAgentId=b25e0528478a49a9dc0c1c85, outputFieldName=Comments, credentialsId=112771, body={"Operation": "Update","RecordType": "Incident","RecordId": "11029","SMId": "IM476662","TenantId": "288888888","TenantBaseURL": "https://us1-smax.saas.microfocus.com","DispatchedRecordId": "11030"}}
        Finished executing action Business Rule Evaluation with result: {}
        Finished executing action Post Commit Command Execution with result: {}

     

     

    If you have any suggestions to fix this i'm open to test some things.

    Otherwise I have opened a case with MF and sent them these findings.

  • Hello,

    It is hard to follow and troubleshoot without seeing the business rule itself and access to the logs.

    Since you opened a ticket, please continue using the support channel.

    Best regards,

    Brindusa