Forums

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

How to hide a field on customer portal and set a default value?

Gabriel MOSCALU December 4, 2018 edited

Hi,

 

Need a bit of help.

 

In order to ease customer experience while keeping up the functionalities, i decided to hide some of the fields from the portal and populate them with default values. Since we chose to use one project (and one serviceDesk) per customer contract model, we have over 300 projects and servicedesks, so i wrote some script to call the REST API when setting-up the  projects.

 

In this script, after cloning the template projects (with ScriptRunner CopyProject builtin script), i need to tune the customer portal:

* fields like "security" are already hidden, so I managed to set their default value using the following curl:

curl -u $USERNAME:$PASSWORD  "$JIRA_URL/rest/servicedesk/1/servicedesk/$REQRTID/request-type-fields/$REQFLDID/preset"  -H 'content-type: application/json' -H 'accept: application/json, ' -H 'referer: $JIRA_URL/servicedesk/admin/$NEW_PROJECT_KEY/request-types/request-type/$REQRTID' --request POST --data-binary "{\"values\":{\"$REQ_FIELD_NAME\":[\"$REQ_FIELD_VALUE\"]}}" --output out/$NEW_PROJECT_KEY.SERVICEDESK_REQTYPES_DEFVAL_UPD.out --silent

* the other fields, need to be hidden and setup with a default value

 

I have tried the:

curl -u $USERNAME:$PASSWORD  "$JIRA_URL/rest/servicedesk/1/servicedesk/$REQRTID/request-type-fields/$REQFLDID/preset"  -H 'content-type: application/json' -H 'accept: application/json, ' -H 'referer: $JIRA_URL/servicedesk/admin/$NEW_PROJECT_KEY/request-types/request-type/$REQRTID' --request POST --data-binary "{\"values\":{\"$REQ_FIELD_NAME\":[\"$REQ_FIELD_VALUE\"]}}" --output out/$NEW_PROJECT_KEY.SERVICEDESK_REQTYPES_DEFVAL_UPD.out --silent

followed by:

curl -u $USERNAME:$PASSWORD  "$JIRA_URL/rest/servicedesk/1/servicedesk/$REQRTID/request-type-fields/$REQFLDID/hide"  -H 'content-type: application/json' -H 'accept: application/json, ' -H 'referer: $JIRA_URL/servicedesk/admin/$NEW_PROJECT_KEY/request-types/request-type/$REQRTID' --request PUT --output out/$NEW_PROJECT_KEY.SERVICEDESK_REQTYPES_HIDE.out  --silent

 

 

The variables contain the following:

REQRTID = actual Request Type ID returned for that specific servicedesk

* REQFLDID= actual Request Field ID returned for that specific servicedesk & Request Type

* NEW_PROJECT_KEY = the project key

* REQ_FIELD_NAME = the field name (custom_XXXXX or system field name)

* REQ_FIELD_VALUE = a valid value (or corresponding valid ID for drop-downs)

 

For some reason it is not completed successfully, it looks like I am missing something...

 

Is there anyone able to help me pinpoint the issue and spare us from tens of clicks???

 

Thanks

Gabriel

1 answer

0 votes
Morgan Folsom
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.
December 4, 2018

Hi Gabriel, 

I can't speak to your specific calls, but one item that did stick out is Security - I assume you mean Security Level, which is an unsupported field on Request Types (although it is able to be added).

See: https://jira.atlassian.com/browse/JSDSERVER-4259 

"Security Level is an unsupported field and should not be available to be added as stated in the product documentation: Configuring request types and workflows". 

If you try the same script without that aspect, do you still have the same issue?

 

Morgan

Gabriel MOSCALU December 4, 2018

Hi Morgan,

 

Actually, Security is added to the portal, but hidden & I get to set it's default value all right.

 

Where I have a problem is when I try to hide & set default value to other fields (mainly custom fields)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events