Hi Community, Is it possible to set default value in user picker custom field by the current user in customer portal? using behavior ?
I need to capture the current user on" Requested for " user picker custom field like on the above "Raise this request on behalf of" system field.
I tried it using this behavior , place it on Initialiser, mapped to Service Desk Project, because I just want it to become a default value. but no luck, any chances? When I try to check the console in chrome (f12)
When user is admin account, it can capture the user and place on the field, but when the user is customer account, it returns this error
Upon checking the behavior log , it returns this message:
2018-10-04 02:02:06,584 http-nio-8080-exec-8 DEBUG legoteam 122x13663x1 12ftncq 54.153.253.180,10.66.49.4 /rest/scriptrunner/behaviours/latest/jsd/jsd/validatorsByPid.json [c.o.j.groovy.user.FieldBehaviours] ------------------------TESTING BEHAVIOR-------------------------------
Upon checking /rest/scriptrunner/behaviours/latest/jsd/jsd/validatorsByPid.json, it returns this message:
"Cannot retrieve validators from PortalID: '{null}' , Request Type ID : '{null}'"This is the code:
import com.onresolve.jira.groovy.user.FormField
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
def requestorField = getFieldById("customfield_10385")
def currentUserName = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName()
requestorField.setFormValue(currentUserName)
Hey, @Evanthia Charalampidou ! We just published a script to the Adaptavist Library based on this exact use case.
https://library.adaptavist.com/entity/comment-on-jira-issue-for-linked-confluence-pages
The script presumes that you have ScriptRunner for Confluence and ScriptRunner for Jira, though you need only to configure the Event Listener in Confluence. The script is written for Jira 8.x and Confluence 7.1+, but could probably be tweaked for a lower version so long as you have the latest compatible version of ScriptRunner.
Hi @Jonny Carter -- is there a chance there is a similar use case for the Cloud version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mark Kindy- yup! Take a look at https://docs.adaptavist.com/sr4cc/latest/features/script-listeners . That details how to create a Jira ticket, not a comment, but you should be able to use the REST APIs to create a comment just as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.