How to (re)create and delete comments depends on custom fields?

Hi,
I try to complete this workflow scenario:
I defined custom string field named extDoc. Then I wrote this rule:

rule Add link to extDoc to task description
when extDoc.changed && extDoc!=null {
  addComment("http://docstore.ourcompany.net/view.php?id="+extDoc);
}

That works fine and create hyperlink to comments. But now I need to find all such comments and delete them before I create new one - goal is to have maximum one hyperlink to actual version of external documentation.

I try to write it in pseudocode:
rule Add link to extDoc to task description
when extDoc.changed {
   for each comment in comments {
     if (comment.text.contains("http://docstore.ourcompany.net/view.php?id=") {
       removeComment(comment);
     }
   }
   if(extDoc!=null){
      addComment("http://docstore.ourcompany.net/view.php?id="+extDoc);
   }
}

Problems:
  • I don't know any command like "removeComment"
  • comment.text.contains doesn't work, it shows error message. comment.text is ok, but .contains is problem - probably not available in this context.

Any advice how to solve this?

Thx a lot!
0
15 comments
Unfortunately, there is no 'removeComment()' method in the workflow.

comment.text.contains() works for me, do you get it in completion Ctrl+Space?
0
It's a bit strange, when I type
comment.text.contains
as a result I get an error.
When I use completion via Ctrl+Space and select "contains", it works.

OK, when "removeComment" is not available, how to at least change the current comment text? Is a way how to manage it?
I tryied comment.text = "some new value", but doesn't work. Thx a lot for any idea.
0
Please try comments.added.first.text = "test";.
0
Finaly solved this way:

ruleAdd link to external documentation to task description

when extDoc.changed{
  var addNew = true;
  for each comment in comments{
    if(comment.text.contains("http://docstore.ourcompany.net/view.php?id=",ignoreCase)||comment.text.contains("Link to doc deleted",ignoreCase)){
      if(extDoc!=null){
        comment.text="http://docstore.ourcompany.net/view.php?id="+extDoc;
        addNew=false;
      }else{
        comment.text="Link to doc deleted";
        addNew=false;
      }
    }
  }
  if(addNew==true){
    addComment("http://docstore.ourcompany.net/view.php?id="+extDoc);
  }
}

It works. The only problem is, that I'm not adding comments and so comments list doesn't refresh at all. I need to reload page in browser (e.g. F5 key) to see changed comments. Is there any way how to force comments refresh?
0
I've an idea to solve this refresh using applyCommand, but I wasn't able to find out, which "commands" are available to run? Is there any list of available commands? Only example is about applyCommand(add work ...
Thx
0
After quick look at those links it seems not possible to force comments list refresh using applyCommand. Any other way, how to solve this problem? Thx a lot.
0
Unfortunately there isn't such command in YT and I even cannot imagine a workaround :(
0
:( So I vote at least for "removeComment" function ...
0
Avatar
Permanently deleted user

 Unfortunately, there is no 'removeComment()' method in the workflow.

0
Avatar
Permanently deleted user

 Unfortunately, there is no 'removeComment()' method in the workflow. http://https://bestcellular.com/product/simglw416c/ 

0
Avatar
Permanently deleted user

Unfortunately, there is no 'removeComment()' method in the workflow. SIMGLW416C

0
Avatar
Permanently deleted user

Unfortunately, there is no 'removeComment()' method in the workflow. http:// SIMGLW416C 

0

Please sign in to leave a comment.