Highlighted
Super Contributor.. Super Contributor..
Super Contributor..
74 views

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?

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

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

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

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.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.