CPrime Power Script Listener Not executing on Event

Jason G April 19, 2018

We have a business requirement where we want to propagate a custom field from an epic onto all issues with a link of "Epic-Story Link" and from them onto any sub-tasks.

 

To do this we intend to use a Listener script associated with the "Issue Updated" system event

and a second listener associated with a custom event specific to the update of the field in question

The details of the scripts are below

 

Listener 1

s

string managedProjects = {"CORETM"};
string tempoAccountFieldName = "Account";
string epicLinkFieldName = "Epic Link";
string epicLinkFieldID = "customfield_11131";
string tempoAccountFieldID = "customfield_12130";
string myepickey;
boolean raiseEvent = false;

JFieldChange [] changes;

print("tempoAccountUpdateEventEmitterListener fired for " + key);

if ( elementExists(managedProjects, project) ) {
changes = lastIssueChanges(key);
for(number i = 0; i < size(changes); i++) {
if (changes[i].field == epicLinkFieldName) {
myepickey = %epicLinkFieldID%;
if (isNotNull(myepickey)) {
%tempoAccountFieldID% = %myepickey%.%tempoAccountFieldID%;
print("tempo account field copied from " + myepickey + " on to " + key);
raiseEvent = true;
}
}
if (changes[i].field == tempoAccountFieldName) {
raiseEvent = true;
}
}
}
if (raiseEvent) {
print("Tempo Account Updated event fired for " + key );
raiseEvent("Tempo Account Updated", key, currentUser());
}

 

Listener 2 

string linkTypeName = "Epic-Story Link";
string epicIssueType = "Epic";
string tempoAccountFieldID = "customfield_12130";
string [] linkkeys;

if (issueType == epicIssueType) {
linkkeys = allLinkedIssues(key, linkTypeName);
} else {
linkkeys = subtasks(key);
}
for (string linkkey in linkkeys) {
print("tempo account field copied from " + key + " on to " + linkkey);
%linkkey%.%tempoAccountFieldID% = %tempoAccountFieldID%;
}

 

Listener1 is associated with the system Event "Issue Updated" and Listener2 is associated with the custom event "Tempo Account Updated".

 

Currently neither script is executing.  Any assistance would be greatly appreciated.

 

 

1 answer

0 votes
Jonathan Muse {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 24, 2018

Hi @Jason G, unfortunately, Tempo fields are not supported at this time since their API is rather closed off. That is probably why it appears that your listener is not firing.

Alos, I noticed that in the first line the value is given as if it were an array but the variable is not defined as such:

string managedProjects = {"CORETM"};

Should be

string [] managedProjects = {"CORETM"};

Or

string managedProjects = "CORETM";

This may have something to do with it as well.

Thanks

Suggest an answer

Log in or Sign up to answer