Creating a new custom resource for the SugarCRM provider and also enabling it for API calls is a complex process that requires special settings within the SugarCRM UI. Also, creating a new custom resource for SugarCRM does not involve adding it to the available objects on the SugarCRM element. The new resource must be manually added in the API docs of the SugarCRM element.
Here are the steps to be followed:
1. Settings on SugarCRM UI:
- Create a new package from the section Admin => Developer Tools => Module Builder and add a module key. This key is unique and will be used to prefix all directories, class names and database tables for all modules in this new package.
- Create a new module for the above package and add relationship fields for the new custom resource.
- When all field settings are in place, use the Deploy button from the package settings.
- The new custom resource can now be viewed in SugarCRM UI tab as the ModuleName and accessed through SugarCRM API calls via the endpoint which is built like /packageKey_ModuleName.
- A package can have multiple modules thus meaning it can have multiple resources; for each new resource, the packageKey will remain unchanged while the ModuleName will be unique.
2. Settings on CE UI:
- Retrieve the endpoint for the custom resource created in step 1.
- Open the resource tab of the SugarCRM element and map the new endpoint to /packageKey_ModuleName.
- Add the keyword records as the request and response root key and choose the Supported Pagination type.
- Add a Response Model for the new API call.
After steps 1 and 2 are done, the new custom resource will be available in the SugarCRM element and, also, it can be retrieved through the GET /objects call.