These methods help you configure the Submit Ticket form in the way you want it to be on the ASAP help widget.
The Submit Ticket form in your ASAP help widget displays the same fields configured in the ticket layout on your Zoho Desk portal.
To hide any fields in the form, use the setFieldsListTobeShown() method:
Swift
ZDPortalSubmitTicket.setFieldsListTobeShown
(fields: <#[ZDVisibleTicketField]#>)
Objective-C
- [ZDPortalSubmitTicket setFieldsListTobeShownWithFields:
<#(NSArray * _Nonnull)#>];
Here, ZDVisibleTicketField is a class containing two properties: departmentId (an optional string), layoutId, and an array of field names. You must pass this method's list of fields (apiNames) as strings. Depending on the help widget's department mapping, you might also have to pass the departmentId key. For example, if the add-on is configured for a specific department, you don't need to pass the departmentId key. If the add-on is configured for multiple departments, you must pass the departmentId key to ensure department-ticket field mapping in the Submit Ticket form. After you include this method, the form displays only the fields you passed. However, remember that mandatory fields are not hidden even if you do not pass their names in the method.
If you want to hide a mandatory field in the form, you can do so, provided the field's value is pre-filled. To do this, you must use the preFillTicketFields() method. The preFillTicketFields() method proves helpful when populating fields with values, such as auto-generated IDs or device OS versions.
To use this method, you must pass the list of PreFillTicketField objects and the departmentId key, depending on the help widget's department mapping:
Swift
ZDPortalSubmitTicket.preFillTicketFields(forForms: <#[ZDCustomizedTicketForm]#>)
Objective-C
- [ZDPortalSubmitTicket preFillTicketFieldsForForms:<#[ZDCustomizedTicketForm]#>];
Here, ZDCustomizedTicketForm is a class containing two properties: departmentId (an optional string) and an array of customized ticket fields. Just like in the case of the setFieldsListTobeShown() method, if the add-on is configured for a specific department, you don't need to pass the departmentId key. If the add-on is configured for multiple departments, you must pass the departmentId key to ensure department field mapping.
The ZDCustomizedTicketField object contains three main properties:
1. deptId - ID of the department you want to configure the Ticket Fields list.
2. layoutId - ID of the particular layout for which you want to configure the Ticket Fields.
3. fieldApiName—string—the APIName of the ticket field. You can retrieve the APIName of each field using the getTicketForm() method.
4. field value - is the object.
- Pass the values allowed as a comma(,) separated string for multi-select fields.
- Pass one of the values allowed as a string for pick list fields.
For date fields, pass the value as a string in the MM/dd/yyyy format. - For dateTime fields, pass the value as a string in the MM-dd-yyyy hh: mm aa format.
- For Boolean fields, pass a String value("true"/"false").
- For all other field types, pass the values as string objects.
- Make sure that the values you pass here are the max length and decimal restrictions defined for the field.
5. editable - Boolean - Key that defines if the value in the field is editable or not.
For more details, check the sample here.Submit a Ticket event with a subscription
To subscribe your app to the Submit Ticket event, use the following method, which involves an event callback:
Swift
ZDPortalSubmitTicket.getCallbackOnCreateTicket
{ ticket in
// will get ticket object on success
}
onError:
{ error in
// will get error on failure
}
Objective-C
- [ZDPortalSubmitTicket getCallbackOnCreateTicketWithCompletion:^(ZDPTicket * ticket)
{
// will get ticket object on success
} onError:^(NSError * error)
{
// will get error on failure
}];
![](https://static.zohocdn.com/zoho-desk-editor/static/images/file.png)
All ticket details are sent to your app if an authenticated user submits a ticket. Only the ticket number is sent if a guest user submits a ticket.
Custom-configuring Ticket actions
Users can perform various actions, including replying to, commenting, and closing tickets.
The following method helps you define which actions must be allowed and which must be disallowed when users access the ticket submission screen on the ASAP help widget:
Swift
ZDPTicketConfiguration.configure.isAddTicketAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isReplyAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentEditAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isTicketUpdateAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentDeleteAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCustomerHappinessThreadAllowed = <#Bool#>
Objective-C
- ZDPTicketConfiguration.configure.isAddTicketAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isReplyAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentEditAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isTicketUpdateAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCommentDeleteAllowed = <#Bool#>
ZDPTicketConfiguration.configure.isCustomerHappinessThreadAllowed = <#Bool#>
Updating user details
The following API helps update the details of users added to your help desk portal:
Swift
import ZohoDeskPortalAPIKit
...
var body = [String : Any]()
body["displayName"] = "displayName"
body["mobile"] = "123456"
ZohoDeskPortalSDK.updateUserInformation(with: body)
{ profile, error in
// on success only profile will return a value, error will return nil
// on failure only error will return a value, profile will return nil
}
Objective-C
- NSMutableDictionary * body = [NSMutableDictionary new];
[body setObject:@"displayName" forKey:@"displayName"];
[body setObject:@"123456" forKey:@"mobile"];
[ZohoDeskPortalSDK updateUserInformationWith:body onCompletion:
^(Profile * profile, NSError * error)
{
// on success only profile will return a value, error will return nil
// on failure only error will return a value, profile will return nil
}];
Params
Dictionary [String: Any] data - Key and value pair. The following keys are included: X, Phone, Facebook, Name, displayName, mobile, country locale, and timeZone.