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)
What version of Jira are you using?
The link you provided is for version 7.0.0
On my version, I can see the "setArchvived" method in the MutableProjectComponent (Jira 8.13.11 API) object but I could not see that option in the 7.0.0 version.
I don't recall when archiving components became possible.
But presumably, if your version can archive, you should be able to take an existing component object, call the setArchived(true) and then use the Service to store the update.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.