function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aaron Wilson 1Aaron Wilson 1 

How to enable ServiceContract access via the data query endpoint?

Hi. I want to use the data query REST endpoint to access ServiceContract data from the context of a Community Cloud user.

Contracts are listed as something that Community Cloud licences have access to, but it looks like they don't have access to ServiceContract data (I originally thought these were the same thing).

For example, the following query works within the developer console in Salesforce, and the REST query works if using an employee auth-token, but when queried on behalf of a Community Cloud user the query fails:

{{url}}/services/data/v51.0/query/?q=SELECT StartDate,EndDate FROM ServiceContract

Error:
[
    {
        "message": "\nSELECT StartDate,EndDate FROM ServiceContract\n                              ^\nERROR at Row:1:Column:31\nsObject type 'ServiceContract' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.",
        "errorCode": "INVALID_TYPE"
    }
]

I can't find an option to enable access to the ServiceContract object in the CommunityCloud users profile.

So how can I enable this?

Cheers, Aaron.
Omar Rajab 94Omar Rajab 94
Hi Aron, 

i am not sure if ServiceContract ist supported for CommunityCloud you can check this here: https://help.salesforce.com/articleView?id=networks_napili_supported_objects.htm&type=0. 

otherwise you can create a sharing rule for ServiceContract  to make the access availabel for CommunityCloud users. 

regards,
Omar