Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Create an issue with custom field data Java API

api

I try to create an issue with one customfield using the Java API.

IssueCustomFieldDataEN[] customFields = new IssueCustomFieldDataEN[1];
       
        // RepPlatform
        customFields[0] = new IssueCustomFieldDataEN();
        //customFields[0].setProjectID(issue.getProjectID());
        //customFields[0].setIssueID(issue.getIssueID());
        //customFields[0].setUserID(issue.getReportedBy());
        customFields[0].setCustomFieldID(189);
        customFields[0].setCustomFieldData( "1");

issue.setIssueCustomFieldData(customFields);
...

    issue = iwsh.createIssue(issue);

The return issue doesn't have any customFieldData.
No custom field data add to this issue,
no error in log,
no error from web service.


rbr
· 1
rbr
Replies (6)
helpful
0
not helpful

Which version of Gemini are you running?

Are there any errors in Gemini's system log?


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

v3.6.5 Build 2638

No error in system log


rbr
· 1
rbr
helpful
0
not helpful

Can you post the full code?
You have to set the user id and project id.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful





Here:

// Create a new issue entity and set the details.
        IssueEN issue = new IssueEN();
        // Create our issues proxy, passing in the the Gemini url, username and password.
        IssuesWebServiceHelper iwsh = getIssuesWebServiceHelper();

        
        // Pas de produit
        if (aBug.product==null) return null;
        
        // Produit non traité
        if ( getProduct( aBug.product) ==-1) return null;
        
        
        issue.setIssueSummary( "B" + aBug.bugid + " " + convertString(aBug.shortdesc));
    
        
        String dateCreation = convDate(aBug.creationts);
        
        // Dernier de list long
desc
        String dateLast= null;
        {
            longdesc ld = aBug.longdescs.get(aBug.longdescs.size()-1);
            dateLast = convDate(ld.bug
when);
        }
        
        issue.setProjectID(getProduct( aBug.product));

        // Add component
        IssueComponentEN[] comp = new IssueComponentEN[1];
        comp[0] = new IssueComponentEN();
        comp[0].setComponentID( getComponent(aBug.product, aBug.component ) );
        issue.setComponents(comp);
        
        // Add affected version
        AffectedVersionEN[] affect = new AffectedVersionEN[1];
        affect[0] = new AffectedVersionEN();
        affect[0].setVersionID(getVersion( aBug.product, aBug.version ) );
        issue.setAffectedVersion(affect);

        issue.setIssueType( getBugType(aBug.bugseverity));

        issue.setIssueStatus(getStatus(aBug.bug
status));

        issue.setIssueResolution( getResolution(aBug.resolution) );

        issue.setIssuePriority( getPriority(aBug.priority) );
        
        issue.setIssueSeverity( getSeverity(aBug.bugseverity) );

        issue.setFixedInVersion( getVersion(aBug.product, aBug.target
milestone ) );
        
        issue.setReportedBy( getUser(aBug.longdescs.get(0).who ));

        // Add resource
        IssueResourceEN[] res = new IssueResourceEN[1];
        res[0] = new IssueResourceEN();
        res[0].setUserID(getUser( aBug.assigned
to));
        issue.setIssueResources(res);

        // long desc 0
        issue.setIssueLongDesc(convertString(aBug.longdescs.get(0).thetext));
        

        IssueCustomFieldDataEN[] customFields = new IssueCustomFieldDataEN[1];
        
        // RepPlatform
        customFields[0] = new IssueCustomFieldDataEN();
        customFields[0].setProjectID(issue.getProjectID());
        //customFields[0].setIssueID(issue.getIssueID());
        customFields[0].setUserID(issue.getReportedBy());
        customFields[0].setCustomFieldID(189);
        customFields[0].setCustomFieldData( "" + getRepPlatform(aBug.rep
platform));
        customFields[0].setCustomFieldData( "1");

        // opSys        
        /
        customFields[1] = new IssueCustomFieldDataEN();
        customFields[1].setProjectID(issue.getProjectID());
        //customFields[1].setIssueID(issue.getIssueID());
        //customFields[1].setUserID(issue.getReportedBy());
        customFields[1].setCustomFieldID(188);
        customFields[1].setCustomFieldData( "" + getOpSys(aBug.op_sys));
        customFields[1].setCustomFieldData( "1");
        
/
        issue.setIssueCustomFieldData(customFields);
        
        
        
        issue.setRiskLevel(1);
        issue.setVisibility(1);
        issue.setVisibilityMemberType(2);

        if (bRecordInGemini)
        {
            try
            {
                // Create the issue and get it back with the id populated.
                issue = iwsh.createIssue(issue);
                
                out.println("Issue created: " + issue.getIssueID());
            }
            catch(Exception e)
            {
                err.println("Error processing bug: " + aBug.bug_id);
                e.printStackTrace(err);
            }
            
        }        
       


rbr
· 1
rbr
helpful
0
not helpful

This is a bug in the Java sample, which will fix soon.
You should rename the IssueCustomFieldDataEN to CustomFieldDataEN and add a
public String getState() { return "New"; } method to it. You will have to amend the IssueEN class as well to use this new renamed class.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Perfect That's work.

I like to work with you, fats and perfect answer.


Thanks again.


rbr
· 1
rbr