iOS SDK Samples - Share Operations

Get Shared Record Details
          
          
// record is the object of ZCRMRecord
        $record.getSharedDetails() { result in
            switch result
            {
            case .success(let sharedDetails,let response) :
              print ("ResponseJSON : \( response.responseJSON )")
            case .failure(let error) :
              print ( "Throws exception : \(error)" )
        }
}
 
Share Records
          
          
// record is the object of ZCRMRecord
// user is the object of ZCRMUserDelegate
        let sharedDetails =  ZCRMRecord.SharedDetails( user : user,  permission : AccessPermission.Writable.fullAccess, isSharedWithRelatedRecords : true)
        $record.share( details : [sharedDetails] ) { result in
            switch result
            {
            case .success( let response) :
              print ("ResponseJSON : \( response.responseJSON )")
            case .failure(let error) :
              print ( "Throws exception : \(error)" )
            }
        }
 
Update Share Permissions
          
          
// record is the object of ZCRMRecord
// user is the object of ZCRMUserDelegate
        let shareDetails =  ZCRMRecord.SharedDetails( user : user,  permission : AccessPermission.Writable.fullAccess, isSharedWithRelatedRecords : true)
        $record.updateShare(details: [shareDetails] ) { result in
            switch result
            {
            case .success( let response) :
              print ("ResponseJSON : \( response.responseJSON )")
            case .failure(let error) :
              print ( "Throws exception : \(error)" )
            }
        } 
 
Revoke Shared Records
          
          
// record is the object of ZCRMRecord
        $record.revokeShare() { result in
            switch result
            {
            case .success( let response) :
               print ("ResponseJSON : \( response.responseJSON )")
            case .failure(let error) :
               print ( "Throws exception : \(error)" )
            }
        }
 
Get Shareable Users
          
          
let shareableUserDetails = tryshareRecordDetails.getDictionary(key: "ShareableUserDetails")
// record is the object of ZCRMRecord
            $record.id = try shareableUserDetails.getInt64(key: "recordId")
            $record.getShareableUsers { result in
                switch result
                {
                case .success(let userDetails, let response) :
                print ("ResponseJSON : \( response.responseJSON )")
                case .failure(let error) :
                 print ( "Throws exception : \(error)" )
                } 
            }