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: <#T##[ZDVisibleTicketField]#>)
Objective-C
- [ZDPortalSubmitTicket setFieldsListTobeShownWithFields:<#(NSArray<ZDVisibleTicketField *> * _Nonnull)#>]
Here, ZDVisibleTicketField is an object that has three main properties:
1. departmentId: String - ID of the department in which you want to configure the Ticket Fields.
2. layoutId: String - ID of the particular layout for which you want to configure the Ticket Fields.
3. fieldNames: Array<String> - Name of the ticket fields you want to show in your ticket layout.
After you include this method, the form displays only the fields you passed.
However, remember that mandatory fields are 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]#>];
The ZDCustomizedTicketForm is an object that has three main properties:
1. departmentId: String - ID of the department in which you want to configure the Ticket Fields.
2. layoutId: String - ID of the particular layout for which you want to configure the Ticket Fields.
3. customizedFields: Array<ZDCustomizedTicketField> - List of field objects to prefill the Ticket Fields.
The ZDCustomizedTicketField is an object that contains three main properties:
1. fieldNames: String - the APIName of the ticket field. You can retrieve the APIName of each field using the getTicketForm() method.
2. value: String - the format is mentioned below.
- 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.
3. isEditable: Bool - 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
}];
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
- timeZone