cfSetValueWithEventPropagation not propagating?

Dan November 9, 2023

I'm not sure where my error is: I am setting a simple Text field (Id = "EpicLink") from javascript using cfSetValueWithEventPropagation. The field sets correctly. However, the rule that is monitoring the EpicLink field is not triggering. The rule does function correctly when the field is adjusted manually, or if the EpicLink field is updated from elsewhere in the form via a standard "Set Value" rule.

The Javascript (This sets EpicLink without error, but the Rule does not trigger):

<script>
function parseAuditDescription(formName, formId) {
const mydebug = true;

const v_AuditDescription = AJS.$(formName).find('#i_AuditDescription').val();

if(mydebug) alert(v_AuditDescription);

const rx_EpicLink = /\|Audited Epic\|(.*?)(?<!\\)\|/;
const val_EpicLink = rx_EpicLink.exec(v_AuditDescription);
if(mydebug) alert("EpicLink[0]: " + val_EpicLink[0]);
if(mydebug) alert("EpicLink[1]: " + val_EpicLink[1]);
if(mydebug) alert("EpicLink[2]: " + val_EpicLink[2]);

cfSetValueWithEventPropagation(formId, 'EpicLink', val_EpicLink[1]);
}
</script>

The Rule (works if EpicLink is modified manually or if EpicLink is modified by a "Set Value" Rule):

Rule for ConfiForms Field Definitions:
Field name: EpicLink
Condition: !EpicLink:[empty]
Action to execute: Lookup and set JIRA issue data
Values to set: EpicFVReleaseDate=fields.fixVersions.releaseDate&EpicSummary=fields.summary&EpicStatus=fields.status.name&EpicFixVersion=fields.fixVersions.name&EpicLabels=fields.labels&EpicComponents=fields.components.name
JIRA Issue Key: [entry.EpicLink]
Application link: XXXX (my Jira instance identifier)
No event propagation on value change: <unchecked>

Thanks in advance...

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2023

Hi @Dan 

Indeed this seems to be a bug

Try the following workaround instead

 

AJS.$('#' + formId).find('#i_' + fieldName).each(function () {
processWithSetValue(AJS.$(this), fieldValue, true, false, '', false);
});

So instead of 

cfSetValueWithEventPropagation(formId, 'EpicLink', val_EpicLink[1]);

Have this

AJS.$('#' + formId).find('#i_EpicLink').each(function () {
processWithSetValue(AJS.$(this), val_EpicLink[1], true, false, '', false);
});

Sorry about that, we will fix this little annoyance asap (in 3.7.1)

Alex

Dan November 9, 2023

Unfortunately, still not propagating. The EpicLink did populate so the alternative syntax worked fine in that regard, but the subsequent rule is still not triggering (unless I update EpicLink manually or via a "Set Value" rule instead of "Run Custom Javascript" rule).

I checked with our enablement team, and they got back to me saying that we're still on 3.6.1. An upgrade to 3.7.0 will be released when confluence is upgraded to 7.13.19 sometime in the next few months (ugh... didn't realize what versions we were at).

Should your workaround function in 3.6.1, or do I need to wait until our 3.7.0 upgrade to deploy this?

Thanks once again for your detailed help :)

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2023

Sorry about that, a little correction

AJS.$('#' + formId).find('#i_EpicLink').each(function () {
processWithSetValue(AJS.$(this), val_EpicLink[1], true, false, 'input', false);
});

If "EpicLink" is a text field...

Alex 

Like Dan likes this
Dan November 13, 2023

This worked perfectly - Thank you so much!

Is there documentation on the processWithSetValue function that you can direct me to?

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 13, 2023

This is really a private method, we will ensure the "cfSetValueWithEventPropagation" method is fixed (in the upcoming 3.7.1, with an extra parameter to tell what event to propagate, as in my workaround)

Like Dan likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events