jira-client icon indicating copy to clipboard operation
jira-client copied to clipboard

setCustomFieldValues example?

Open tommymarshall opened this issue 10 years ago • 1 comments

What is the syntax for passing multiple custom field values when creating an issue? Here's what I believed it to be:

$issue = new RemoteIssue();

$issue
    ->setProject('PROJECT')
    ->setType(10)
    ->setSummary('Testing (created via the API)')
    ->setCustomFieldValues([
        'customfield_12311' => 'Foo'
    ])
    ->setDescription('This is a test issue (created throug the API)');

But I get an Internal Server Error each time when attempting to create the issue.

I also

$issue = new RemoteIssue();

$company_name = new RemoteCustomFieldValue();
$company_name
    ->setCustomfieldId('customfield_12311')
    ->setValues('Acme Company');

$fields[] = $company_name;

$issue
    ->setProject('PROJECT')
    ->setType(10)
    ->setSummary('Testing (created via the API)')
    ->setCustomFieldValues($fields)
    ->setDescription('This is a test issue (created throug the API)');

But still no go.

tommymarshall avatar Feb 25 '15 21:02 tommymarshall

May be a dumb question but: have you tried setValues(['Acme Company'])? Worked for me.

olek-p avatar Jun 05 '15 14:06 olek-p