2017-08-23 7 views
0

Zendesk java client apiを使用してカスタムフィールドを正しく更新する方法がわかりません。問題はコマンドの構文がわかりません。Zendesk javaクライアントAPIがCustomFieldValueを更新しています

zendesk.createComment()、タグ、およびその他のフィールドを使用してコメントを更新できますが、カスタムフィールドの構文はわかりません。

comment例:

{ 
Zendesk zd = new Zendesk.Builder(url) 
        .setUsername(uid) 
        .setPassword(pwd) 
        .build(); 
} 


private static void setComment(Zendesk zd, long inTicket, String inComment) 
     { 
     Comment cmt = new Comment(); 
     cmt.setBody(inComment); 
     cmt.setPublic(pubPriv); 
     zd.createComment(inTicket, cmt); 

     } 

答えて

0

カスタムフィールドの更新は、次の例

/* 
When a customer ftps a file to TCS we need to update the ZenDesk ticket 
with the file information. The file name is stored in the AddAttachment List 
custom field. This is a destructive field so it must be read first and the 
new data concatenated after a line feed then re-written. 
1) Read current field data 
2) concatenate line feed and new data onto old data 
3) Write new field data 
*/ 
long fieldNum = 25326406; 
showDebug("In addAttachmentList"); 
Ticket ticket = zd.getTicket(inTicket); 
List<CustomFieldValue> cfvl = ticket.getCustomFields(); 
for (int i = 0; i < cfvl.size(); i++) 
    { 
    if (cfvl.get(i).getId() == fieldNum) 
     { 
     showDebug("Original value: " + cfvl.get(i).getValue()); 
     cfvl.get(i).setValue(cfvl.get(i).getValue() + "\n" + inComment); 
     cfvl.get(i).setId(fieldNum); 
     ticket.setCustomFields(cfvl); 
     showDebug("After Update value: " + cfvl.get(i).getValue()); 
     zd.updateTicket(ticket); 
     } 
    } 
} 
を用いて達成することができます
関連する問題