Share Records

Purpose

To share a record with other users in the organization.

Request URL

https://www.zohoapis.com/crm/v2/{module_api_name}/{record_id}/actions/share

Request Method

POST

Scope

scope=ZohoCRM.share.{module_name}.{operation_type}

 
Possible module namesPossible operation types
leads, accounts, contacts, deals, campaigns, cases, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, and custom.ALL - Full access to the records
CREATE - Share records with other users in the organization
Note
  • The records can be shared to other users in the organization only if certain conditions are met. For simplicity, let us assume that User A shares a record with User B. Now, user A can share the record successfully only if:

    • User B is a confirmed and active user.

    • User B does not have access to that particular record.

    • User B has access to that particular module. For instance, to share a contact, user B must have access to the Contacts module.

  • You cannot share the records in Activities module and Linking module directly. They can be shared as related lists.

  • The users who have profiles with share permission can share any records that they have access to, except the records that are shared to them. To check the same, go to Setup> Under Users and Control> Choose Security Control> Choose the profile> Under Tool Permissions> Check if 'share' is enabled. It is enabled by default for Standard and Administrator Profiles.

  • The details of the records that form many to many relationships (with multi-select lookup) cannot be shared.

  • A record can be shared only with 10 users.

  • Once the record gets shared successfully, the user who initiated the share operation will get notified via email.

  • The user can update the shared records using the PUT method. To know more, refer to Update Records.

Request JSON

AttributeData TypeMandatoryDescription
share Show propertiesJSON arrayYesThe JSON object represents the set of users with whom you want to share the record. Each object in the array represents a user.

Possible Errors

HTTP StatusError CodeMessageReason
401OAUTH_SCOPE_MISMATCHinvalid oauth scope to access this URLThe client does not have the scope to ZohoCRM.share.{module_name}.CREATE
(or)
The module name given in the URL is either Events, Calls, Tasks or any Linking module.
(or)
The module name given in the URL is invalid.
404INVALID_URL_PATTERNPlease check if the URL trying to access is a correct one.The URL given has syntactical errors.
403INVALID_DATAENTITY_ID_INVALIDThe record ID given in the URL is either invalid
(or)
does not belong to the module mentioned.
200INVALID_DATAPermission is invalidThe value given in permission is not one of: full_access, read_only, or read_write.
(or)
The user does not have permission to access that particular module.
200INVALID_DATArecord is already visible to the user.The record is already accessible to the user. You can share the record only if the user cannot access it.
403SHARE_LIMIT_EXCEEDEDCannot share a record to more than 10 users.The record you are trying to share has already been shared with 10 users.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2?Contacts/4150868000001176057/actions/share"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@input.json"

In the request, "@input.json" contains the sample input data.

Sample Input

Copied{
  "share": [
    {
      "user": {
        "id": "4150868000001174048"
      },
      "share_related_records": true,
      "permission": "full_access"
    },
    {
      "user": {
        "id": "4150868000001199001"
      },
      "share_related_records": true,
      "permission": "read_only"
    }
  ]
}

Sample Response

Copied{
    "share": [
        {
            "code": "SUCCESS",
            "details": {},
            "message": "record will be shared successfully",
            "status": "success"
        },
        {
            "code": "SUCCESS",
            "details": {},
            "message": "record will be shared successfully",
            "status": "success"
        }
    ]
}