Skip to end of banner
Go to start of banner

Power Scripts : How to add auto comment using listeners

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

In this article you will learn how to add automatic comment every time new ticket has been raised in the project.

  • First of all you have to create a following sil script :

// gather all required data here
string sum1 = description;
string dat = currentDate();
string rep = getUser(key.reporter)[2];
string title = summary;

// add comment
addComment(key,currentUser(), " Hello " +rep+ " you have raised ticket on : " +dat+ " and description of your ticket is : " +sum1+ " Someone from our team will contact you shortly!");

// then save it to a file to check all raised tickets
printInFile("Raised_tickets_2024.txt", " Ticket number : " + key + " Reported by : "+ rep + " Raised on : "+dat+ " Title : " +title);

in this case we will save our script as ticket_summary.sil

image-20240115-121904.png

this script will gather all required data when ticket has been created, like description, current date and summary of the ticket. Then it will add a comment and save all data in a single text file for future data insights if required as this script will be triggered without our attention!

  • now, after script has been created you have to go to > Power Apps Config and click Add listener. In this case script will be triggered whenever event “Issue Created” has occurred in other words when issue will be created. Also you have to specify project where you want this script to work and also locate script path.

image-20240115-122158.png
  • after that whenever issue has been created you should see this comment :

image-20240115-122838.png
  • also all tickets will be available to see in one file under Raised_tickets_2024.txt

    image-20240115-122931.png

  • No labels