# Custom coded workflows using custom objects

**URL:** <https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855>\
**Category:** Data Hub\
**Created:** [April 12, 2022, 2:39pm UTC](https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855 "2022-04-12T14:39:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [April 12, 2022, 2:39pm UTC](https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855/1 "2022-04-12T14:39:51Z")

</div>

Community - hope you can help. I’m working on a complex workflow that uses at least one custom coded workflow step. The issue I’m running into is that I need to search/filter/sort custom objects (rather than contacts/companies etc) in the coded workflow step and I don’t understand how to use the Javascript APIs to access these objects.

Is there a document I’ve failed to find or a code example/snippet somewhere that can help?

Regards

---

<div class="post-metadata">

**Author:** ![PamCotton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pamcotton/32/47916_2.png) [@PamCotton](https://community.hubspot.com/u/PamCotton)\
**Post date:** [April 13, 2022, 9:45pm UTC](https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855/2 "2022-04-13T21:45:45Z")

</div>

Hello @SteveHTM , I would like to invite our top experts to share their ideas @LMartinez7 @bryce-corey any recommendations to @SteveHTM matter?

Thank you,

Pam

---

<div class="post-metadata">

**Author:** ![nikodev](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nikodev/32/44733_2.png) [@nikodev](https://community.hubspot.com/u/nikodev)\
**Post date:** [May 24, 2022, 8:56pm UTC](https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855/3 "2022-05-24T20:56:25Z")

</div>

Hey there @SteveHTM,  
There are a few ways to make API calls related to custom objects. The most important part of this is identifying what’s called the objectTypeId of the custom object. The easiest way to identify this id in the CRM is by going to the index page of the custom object you’re looking to query, and take a look at the url.

I’ve attached a screenshot of an example. Note the part highlighted at the top. The object type id will always be in this portion of the url on the index page of the custom object. It will always be in the format “2-” followed by…I think it’s 6 or 7 digits.

Another option would be to retrieve all schemas in the portal and find the ID based on the label of the custom object, or the schema name - “Hospital” for example, if we were looking at the object in the screenshot. This, in most cases, won’t be necessary. See the “Get all schemas” endpoint in the docs [HERE](https://developers.hubspot.com/docs/api/crm/crm-custom-objects).

You won’t be able to use the hubspot api client in the same fashion as you would if you were querying the standard objects, which would allow you to use simple dot notation to access the appropriate endpoints.  
Below is an example search api request using a custom object

```lia-code-sample
		let courseSearchObj = {
			filterGroups: [
				{
					filters: [
						{
							value: `${enrollmentInfo.course_id}`,
							propertyName: "thinkific_course_id",
							operator: "EQ"
						}
					]
				}
			],
			properties: ["id", "thinkific_course_id", "name"],
			limit: 1,
			after: 0
		};

		let courseSearchRes = await hubspotClient.apiRequest({
			method: "POST",
			path: `/crm/v3/objects/2-1877015/search`,
			headers: {
				accept: "application/json",
				"content-type": "application/json"
			},
			body: courseSearchObj
		});

```

The docs linked earlier on in this post will give more details on searching via API when working with custom objects. Make sure to navigate to the “Objects” tab.  
Hopefully this helps.

 ![638418_1_Screen Shot 2022-05-24 at 3.08.16 PM.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/1/716311d46e56535ffefaa670d87997a9e1658ba9.jpeg)

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [May 25, 2022, 7:56pm UTC](https://community.hubspot.com/t/custom-coded-workflows-using-custom-objects/54855/4 "2022-05-25T19:56:12Z")

</div>

Thank you @nikodev - this is helpful material that really should be added to the API documentation.

Steve
