Recent searches
No recent searches
Getting started with custom objects
Posted Mar 26, 2021
This is a continuing discussion about the article Getting started with custom objects in the developer documentation.
0
Recent searches
No recent searches
Posted Mar 26, 2021
This is a continuing discussion about the article Getting started with custom objects in the developer documentation.
0
Zendesk uses web cookies to collect information about you when you visit our Site. This information might be about you, your preferences, or your device. At Zendesk, we may use this information for purposes that include ensuring basic functionality of our Sites; remembering user preferences, including your cookie preferences; measuring the effectiveness of our Sites, marketing campaigns, and email communications; and personalizing online content.
Please review the different category headings below to learn more and adjust the cookie settings on your current device. Please note that you will need to ensure that each web browser is adjusted to reflect your preferences if you use different computers or mobile devices.
For more information about how Zendesk uses web cookies, please see our Cookie Notice.
Essential cookies enable core site functionality. These cookies are necessary for the Site to function and cannot be switched off in our systems. You may set your browser to block or alert you about these cookies, but parts of the website may not function properly.
Functional cookies enable the Site to provide enhanced functionality and personalization. These cookies may be set by us or by third-party providers whose services we have added to our Site.
Analytics cookies allow us to count visits and traffic sources so we can measure and improve the performance of our Site. These cookies help us to know which pages are the most and least popular and see how visitors move around the Site.
Targeting cookies, such as social media cookies, may be set through our Site by our advertising service providers, third-party advertisers, ad networks, or data exchange partners. These cookies may be used to show you relevant advertising on other third-party sites.
19 comments
Jason Martens
Hello Matt, to represent many-to-many relationships, you need to create multiple relationship types that go in both directions. Let me know if that doesn't work for you for some reason.
I'm not sure about the Insights question yet, someone will follow up about that.
0
Matt Claycomb
Hello,
In this article, it is specified that a many-to-many relationship is possible, however I am not finding how. If I attempt to submit a request to the API to create a relation which I believe would handle that (source and target are arrays), I get returned an error saying "Cannot create a relationship type where both source and target are arrays".
Also, is there a feature request page for having Custom Resources loaded into Insights? That function could greatly benefit our company as well.
Thank you,
0
Matt Claycomb
Jason,
I am not sure I follow. I know in an SQL database, I would have to use an intermediary table. Take the following example, if I want a many-to-many relationship between the Zendesk type ticket and a custom object named "location", I would have to do the following:
Then any time I want to associate a ticket to a location or an additional location, I would need to do the following:
Can you let me know if I'm on the right track, or completely off base?
Thanks,
Matt
0
Jason Martens
Hi Matt, I think you are on the right track, but I'm not sure you need the `location_ticket` object, unless it's holding additional properties about the relationship. You should be able to create a one-to-many relationship between location -> zen:ticket as well as a one-to-many relationship between zen:ticket -> location. Then when you need to associate a ticket to a location, you would create a ticket -> location relationship for the ticket, and a corresponding location -> ticket relationship if you want to know all tickets associated with a location.
0
Jason Littrell
Under Associating related objects it states:
"A relationship record is governed by a relationship type you created. So far you created a one-to-many type named "pc_has_many_tickets" where each ticket can be associated with only one PC, but each PC can be associated with many tickets."
I'm not seeing this behavior in my tests. The API will let me create multiple relationship records using different PC source IDs with the same "zen:ticket" target. The same applies if I define a one-to-one relationship type. It seems that the single or many schema only affects the number of targets a source can be linked to, but not vice versa. Is this true, or am I doing something wrong?
0
Jason Martens
Hi Jason, when you create multiple relationships with different PC source IDs, you are creating *different* relationships for each PC. The same is true for one-to-one: each relationship is a separate relationship. The difference between one-to-one and one-to-many is that the target field in the one-to-many relationship type is an array. Whereas the target field in the one-to-one is a single ID.
You should not be able to create multiple relationships with the *same* PC source ID in either the one-to-one or the one-to-many example.
Does that help?
0
Matthew Nataloni
Hello,
How can I add a drop down to a ticket form and populate it with custom objects that are related to the requester. I created a ticket field and associated the custom objects to the employee, just have been struggling on how to populate the custom objects into the drop down.
Is this possible?
0
Andrew Schreiner
Hi Matthew,
I think you could achieve this using an app. I don't believe there is anything baked in that you could use.
More info on the ticket apps can be found here.
https://developer.zendesk.com/apps/docs/support-api/ticket_sidebar
You would basically want activate on the app.activated function to retrieve your list for the user and then populate the app with the data from the custom object that you want.
0
Matt Owens
Anyone have an example application that is pulling related Objects on a user?
url: '/api/sunshine/objects/records/zen:user:' + id + '/related/object_record_name',
0
Christopher Cooper
Hi Matt,
Do you have a question about using our List Related Object Records API? You'll want to use the relationship type in the url to return related records. For example, my test account has a user_has_many_devices relationship type. The url I used to get a user's device objects was the following:
https://z3nt.zendesk.com/api/sunshine/objects/records/zen:user:1274575738/related/user_has_many_devices
Best,
Chris
0
Adam Grohs
Is there any way to access sunshine custom object data from within a ticket body - either via macro or preferably a placeholder?
0
Andrew Schreiner
@..., I don't think that's possible. You could write a custom app to insert text into the body of the editor but that would be the only way I know of to get it in there at this time. Sounds like a good idea though so you may want to put in a feature request.
0
prashanth m
How is custom object size determined..? it says 32kb in the documentation, how to find out if my custom object has reached this 32kb limit..?
0
Eric Nelson
Hey Prashanth,
![](/hc/user_images/zprZfXdtJ2qrB6Gz_hcG0g.png)
The object size is determined by the actual byte size of the object being stored. An easy way to tell how large your object is to use postman and a search query for one object. Then you can see the object size by looking at the response body's size. For an example I've included the size of a response with 12 nested attributes (all strings) and an external id. As you can see, you'd need an absolutely massive custom object to come anywhere near this limit.
Hope this helps!
Eric
0
Levente Nagy
Hi,
---------------------------------
---------------------------------
---------------------------------
I need to add a "custom lookup relationship" field to my tickets referencing to a custom object. But it seems like I can only add one referencing to tickets, organizations or users. According to this article its possible as stated:
"One approach to building this app would be to add a dropdown list to the ticket form in Help Center that lets users select a PC when they submit a ticket."
But the instructions are unclear. Regardless of how many relationships I define, my custom object refuses to show up under the "related object" dropdown in when defining a custom lookup relationship field.
---------------------------------
What am I missing here?
1
Jacquelyn Brewer
Levente Nagy I think the issue is that you're trying to use lookup relationship fields with custom objects, but instead you need to be defining relationships between the objects either via the Relationships page in Admin Center or the API (https://developer.zendesk.com/documentation/custom-data/custom-objects/getting-started-with-custom-objects/#modeling-your-data).
0
Itay Banner
Jacquelyn Brewer I'm having the same issue as Levente Nagy and I feel trapped in a vicous circle.
My use case: I run a website agency. I have clients (organizations) for whom I manage websites (one or more). Each site is either hosted on my server or externally.
My objective: I want to be able to see, under each organzation, which websites I manage for them and where they're hosted.
What I did:
What I tried to do then:
In the Admin Center, under People > Configuration > Organization fields, I tried to create a lookup field to manage the custom object records for the organization. I expected to be able to see my custom object available to select in that same dropbox marked in red in Levente Nagy's post.
What are we missing, then?
What's the right way to manage relationships with custom object records in the interface? or is it just an API feature? If there is a way, please can you provide a detailed documentation, as the current articles you linked to are not helpful.
0
Christopher Kennedy
Lookup fields are available as part of the new Custom Objects EAP. Have you signed up for the EAP?
0
Itay Banner
Christopher Kennedy Just did, thanks.
0