Hello! I have a slack workflow set up and I am trying to create an automated weekly slack post within my set up Slack group that summarizes our overall average NPS plus the average % of Promoters, Passives, and Detractors. I have used the calculate metric to set up a workflow for average NPS and the count of Promoters, Passive, & Detractors in the last 7 days, but cannot use it to create a “%” for those that are Promoters, Passive, & Detractors.
My TAM has recommended I use the “code” task to write a simple javascript that says something like ::count of promotors in last 7 days:: / ::total count of surveys in last 7 days:: and have it add a “%” but they cannot write this javascript for me. I was wondering if any one could help me with what I should/could put in the code to do this.
This is what the code in workflow looks like:
function codeTask() {
return {
result: ""
}
}
An example of 1 of the count records that I can pipe in looks like:
~{ch://OCAC_3koWZQxHi6nxxcr/sampleStats_count} -->> this is my total count for the last 7 days
I am very new to javascript so any help would be great, and double great would be help + some description to help me replicate. I REALLY appreciate it!