Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Account to User Picker Custom Field on Customer Portal

Alvin
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.
October 3, 2018

Hi Community, Is it possible to set default value in user picker custom field by the current user in customer portal? using behavior ?

Screenshot from 2018-10-03 11_29_58.pngI 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

Screenshot from 2018-10-03 13_38_08.png

 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)

6 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Alvin
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.
October 5, 2018
Daniel Yelamos [Adaptavist]
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.
October 5, 2018

Hello Alvin.

We appreciate the urgency of your issue, but as far as I know, your issue is already assigned to one of our best support staff. Please be patient, as your issue doesn't look like something trivial, and we have more than one customer to attend in the course of one day.

We appreciate your patience and thank you for it.

Do say if I can be of any help.

Cheers

DY

IT User Support October 5, 2018
Alvin
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.
October 9, 2018

@JamieA

@Jamie Echlin _ScriptRunner - The Adaptavist Group_

This is the issue pertaining to SRJIRA-2998

Stefan Bärthlein May 26, 2020

@Alvin did you solve the problem? I've got the same problem using scriptrunner 6.0.2-p5.

If I log it, it shows the value has been updated but it the value does not show up in the customer portal's userpicker :o(

 

regards,

Stefan.

Alvin
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.
May 26, 2020

Hi @Stefan Bärthlein ,

Good day! If you have an extension for jira service desk, you can go to project settings and check on the bottom part, the extension , and click on General.

From there you will see a 'fill user picker' field , just put the user picker custom field you've made on that line :)

I haven't resolved it via scriptrunner. Let me know if you need any help :)

Best Regards,
Alvin

project_settings.png

Stefan Bärthlein May 26, 2020

Hi @Alvin 

thank you very much for the fast response!!!

How is this extension called, I assume you mean an "addon" like scriptrunner by that?

I want to solve the problem with scriptrunner as I don't have any money to spend on a new addon for now :o(

 

Regards,

Stefan.

IT User Support May 26, 2020

Hi @Stefan Bärthlein 

As far as I know, yes it is an addon. Have you tried to use the code I've provided above?

Stefan Bärthlein May 26, 2020

Yes, I tried everything I could imagine - just opened an issue at adaptavist. 

Thank you very much!

Alvin
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.
May 26, 2020

Hi @Stefan Bärthlein ,


Here's the link that I've raised on adaptavist regarding with this issue:

https://productsupport.adaptavist.com/browse/SRJIRA-2998

Stefan Bärthlein May 26, 2020

Hello @Alvin 

thanx for the link, I think this is another problem because I have a different setting, the user can select other users but I'm unable to set the value in the customer portal using the sr behaviour.settings.png

0 votes
Alvin
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.
October 3, 2018

Can someone help? Thanks

IT User Support October 4, 2018

can someone help from adaptavist? thanks

0 votes
IT User Support October 3, 2018

Hi @Thanos Batagiannis [Adaptavist] , I am logging in as customer account and as admin account. If admin account is the current user,  it will be placed on the requested for field, if a customer account. it will not update. any suggestions?

0 votes
Thanos Batagiannis [Adaptavist]
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.
October 3, 2018

Hey Alvin, 

I think you have to check the application logs. There should be more information in there. 

I believe the problem is with the 

ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName()

If the user is not logged in then this will return null 

IT User Support October 3, 2018

Hi @Thanos Batagiannis [Adaptavist] , is it on the built in scripts?

Thanos Batagiannis [Adaptavist]
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.
October 4, 2018

Hey Alvin, 

You raised an issue on our support portal, I replied to you over there, telling you the same thing, to please check your application logs and attach them. 

Your issue is not going to be solved by mentioning people in the community. 

Regards, Thanos

Alvin
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.
October 4, 2018

Hi @Thanos Batagiannis [Adaptavist], I already replied. 

Alvin
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.
October 4, 2018

I attached two files already

0 votes
Alvin
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.
October 3, 2018
Keri
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2018

Sorry, I'm not a ScriptRunner expert, hopefully someone from the ScriptRunner thread can help. 

IT User Support October 3, 2018

Hi @Keri, do you think it is a problem within json of jira api itself?

0 votes
Alvin
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.
October 3, 2018
Alvin
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.
October 3, 2018
Alvin
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.
October 4, 2018

+1

TAGS
AUG Leaders

Atlassian Community Events