Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to notify custom approver using SIL? Notification going to default value instead

Wade Farrell January 31, 2019 edited

Hi there,

First of all, thank you in advance for any help you may offer! 

We are having an issue with notifications being sent to the default value of a custom approver field which is updated on the transition via a SIL script, pulling a user from active directory.

So the order from the begining of the workflow looks like this:

CreateIssue > Transition where SIL updates new approver in custom field > Approval required status where the approver is pointing at the custom field.

Notfications that should be going to the updated approver are instead going to the default value of the custom field. The process works fine if they go in and manually approve but the notification will not work correctly. If I go into the issue after it hits the approval required step, the updated approver is there as expected. Please let me know if anything is unclear or if you need further details. 

PS- This kind of feels like how Async code works when you dont have a callback/promise.

Thanks again!

1 answer

0 votes
Boris Georgiev [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.
January 31, 2019

This might be because of the position of the SIL post function in the list of functions for this transition.

It would be helpful if you provide a screenshot of the transition post functions list or even better - a workflow XML export - if it does not contain any private data.

if the SIL post function is on the last position, try moving it UP in the list.

Wade Farrell February 1, 2019

workflow.JPG post funtions.JPG So right after the ticket is created, it goes to the approval step. My theory is that it's hitting that approval before the post function finishes running. 

Boris Georgiev [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.
February 1, 2019

Does it make a difference if you move the function to position 3 ? I think my advice about the position was not quite correct - take a look here Customizing workflows

Here's the quote from the docs:

Note

When writing post functions, conditions or validators for the Create issue transition, ensure that the SIL program is the last step of the transition. This is necessary because we need Jira to create the actual issue and save it to the database using the input parameters before we can access it.

Note

In general, it's a good idea to place your post functions after all standard post functions.

Wade Farrell February 1, 2019

I reordered and still the same result. By default, will jira finish running the script before it actually moves to that status? Is there anything I might want to check in the logs? I got in there before and wasnt 100% sure what I was looking at or for. All the other notifications are working as they should. 

Wade Farrell February 7, 2019

I reordered some things and here's the XML for initial actions. Let me know if you need more of the file. I added the post functions store updates and reindex below thinking that may help but it did not. I can move them back down.

<initial-actions>
<action id="1" name="Create Issue">
<meta name="opsbar-sequence">0</meta>
<meta name="jira.description"></meta>
<meta name="jira.i18n.description"></meta>
<meta name="jira.i18n.title">common.forms.create</meta>
<validators>
<validator name="" type="class">
<arg name="permission">Create Issue</arg>
<arg name="class.name">com.atlassian.jira.workflow.validator.PermissionValidator</arg>
</validator>
</validators>
<results>
<unconditional-result old-status="Finished" status="Open" step="11">
<post-functions>
<function type="class">
<arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueCreateFunction</arg>
</function>
<function type="class">
<arg name="path">glgrp/Workflow_Post_Functions/AddApproverBasedOnLdapManager.sil</arg>
<arg name="full.module.key">com.keplerrominfo.jira.plugins.jjupinkepler_SIL_postfunction</arg>
<arg name="class.name">com.keplerrominfo.jira.plugins.jjupin.workflow.SilPostFunction</arg>
</function>
<function type="class">
<arg name="path">glgrp/Workflow_Post_Functions/AddDepartmentBasedOnLdapManager.sil</arg>
<arg name="full.module.key">com.keplerrominfo.jira.plugins.jjupinkepler_SIL_postfunction</arg>
<arg name="class.name">com.keplerrominfo.jira.plugins.jjupin.workflow.SilPostFunction</arg>
</function>
<function type="class">
<arg name="path">glgrp/Workflow_Post_Functions/autoApprove</arg>
<arg name="full.module.key">com.keplerrominfo.jira.plugins.jjupinkepler_SIL_postfunction</arg>
<arg name="class.name">com.keplerrominfo.jira.plugins.jjupin.workflow.SilPostFunction</arg>
</function>
<function type="class">
<arg name="full.module.key">com.atlassian.jira.plugin.system.workflowissue-store-function</arg>
<arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueStoreFunction</arg>
</function>
<function type="class">
<arg name="full.module.key">com.atlassian.jira.plugin.system.workflowreindexissue-function</arg>
<arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg>
</function>
<function type="class">
<arg name="eventTypeId">1</arg>
<arg name="full.module.key">com.atlassian.jira.plugin.system.workflowfireevent-function</arg>
<arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>
</function>
</post-functions>
</unconditional-result>
</results>
</action>
</initial-actions>

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events