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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Bulk import custom field values via PHP cURL

Edited
Artemy Matvienko
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.
Dec 15, 2017

I'm trying to json_encode the following PHP array while following the bulk import custom field values example.

$values = 'AAA\nBBB\nCCC';
$data = array(
'FIELD_FCS' => $contextId,
'FIELD_IMPORT_VALUES' => $values,
'canned-script' => 'com.onresolve.scriptrunner.canned.jira.admin.BulkImportCustomFieldValues'
);
$data = 'scriptParams='.json_encode($data, JSON_HEX_AMP | JSON_HEX_APOS); //the options will be useful when I use real values

The $values is formatted to have each value delimited by a slash. This format is required to use the API. When I try to json_encode the $data array and send it to the API, it simply adds 1 dropdown option of AAA\nBBB\nCCC, instead of creating 3 separate options.

I'm not sure how to force it to create 3 values instead of just 1. I tried increasing and decreasing the number of slashes, but to no avail.

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Artemy Matvienko
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.
Dec 15, 2017

Nvm, I just realized that those are newline characters, not slashes, that delimit the values. But I did have to strip one of the slashes from the json_encoded result to make it work.

TAGS
AUG Leaders

Atlassian Community Events