New CRM Object Property Field for Custom Modules

A developer walks through a new CRM object property field that lets you pick and display specific data from your CRM objects. You can build dynamic tables or cards, reorder fields in real time, and control what shows on your site without rebuilding.
Hey there. I just wanted to introduce you to the new CRM Object property field. This field allows content creators to pick properties from a CRM object type. So think the properties of a product field. For example, it would have the product description unit cost when it was created, who created it, etc. Then what this field actually does on the developer side is it gives you an object filled with all of the metadata for that property in the object. So what this is where this is different from like say the CRM object field itself is that this doesn't give you the values of that object. Instead it gives you the metadata. So it gives you like the label for that property. It gives you the actual property name so you can use it programmatically. It gives you the type. So say you wanted to format strings different than you did, like integers. You can do that. So let's kind of dive into a little bit of a use case and how you could use this. So I created a module here, and in this module I have only two fields. I have product property, and then the CRM object field, which I will name product. All right, so that makes it a little more clear. And then in my c, in my new field for the properties, what I've done is I have made it plural properties, and I went and made it a repeater field. This will make a little bit more sense in just a second. So with this field, as well as with the CRM object field, you need to specify what the CRM object type is that you're grabbing the data from. In this case, I am picking properties, and you can also pick a default property to be displayed, and this will automatically change to just what that custom object or object actually has. So in this case, I want it to be the product description, because every single time that I expect someone to use this module, they're going to want the description to be displayed. And so this repeater, as I was saying before, it'll allow us to iterate through multiple different selections that the content creator has done. All right, and now let's talk about the CRM object field. We're doing something similar here, where you are grabbing, you're setting the same exact object type. We're going to pick product, we're going to leave properties to fetch blank. That'll make it so that our properties field can effectively be used to control the what is actually visible in the actual page. All right, now we make sure that the repeater is toggled on. This will allow you to pick multiple splits specific objects. So, quick demo in the previewer of what this will look like. So you'll have two fields, product, property, and product. So I know that for every one of my products that I'm going to display in a table, I want the product description, I want the name, and then I want the unit price. All right, great. Now, just to give a little context here, as you can see, this is a table, and it's. These are the columns in that table. And now if we go and add a new product, we'll pick Search Engine Optimization. Let's add another product. We'll pick Website Accessibility Audit. Cool. All right, now, I've just created this table and there's a few benefits to having created it this way. So, for example, as a content creator, they can be like, you know what, I want the unit price to display first, then I want the name, and then I want the description, all right? And reordered, and voila. They didn't even have to talk to the developer about it. You can do the exact same thing if you're like, you know what, I want to promote this service above the other service, because that's our specialty or something. So you can reorder them. There we go. And it updates in real time. And let's take a look at how this actually is working behind the scenes. So, as you could see up above, I was just displaying the raw data that those fields are actually outputting. But just flip back just so that you can see what I was referring to. This is what the property field outputs. This is what the CRM objects field outputs. And there are multiple objects inside of each that represents each of these selections. All right, so in our code, in order to generate those headers for that table, we need to go forward. For each property that is inside of that object field, we loop through those and create a td. What we're wanting is not the prod, the property's name, or the full object. All we want is the label, the human readable label. So everything that is in the definition of the property itself is available. So we would do property dot property definition. And then I know that the label is inside of that, so I can do dot label to get that data. And so this will loop through all of them in the order that the content creator selected and output the table columns now. And actually, these should be technically table headers, now that I think about it. Anyways. So aside from that little coding goof up on my part, now let's talk about the objects. The objects are just slightly more complicated, but it's really not that bad. So for each of the objects that are selected inside of that module field, I want to create a new row and the for each of the properties that were selected in the properties field, I want to loop through those in the same exact order and I want to create new columns for those. And then I need to display the actual value. So we first get the CRM object and print that. And inside of the CRM object is a properties object. That properties object we can actually compare against the selected property, just like you might do with grabbing an item in an array or object in JavaScript, etc. So the really cool output of all this is this is really not a lot of code and it's not complicated, it's fairly simple. And yet to the content creator, this gave them a ton of flexibility. You can extend this same idea out to create different things. Like maybe, maybe comparing products isn't necessarily what you're aiming to do. You just want to do something like make it so that a marketer can create a list of cards for marketing events, but give them control over the order in which the data displays. It doesn't have to be in a table. Could literally just be like cards you'd see traditionally with blog posts or marketing events. And you would put like allow them to reorder the date, who's hosting it, where it is, and the description, and they can just reorder those things. That's one way of doing it. And so then you could also again, involve the CRM object field if you want to. Instead of just listing all of the marketing events that have yet to happen yet, you could make it so it's kind of more like a featured marketing events situation. And so that's where creating something like this is useful, where you can add specific items and loop through them as well as enable them to reorder them, etc. So that's the CRM object property field. And I am so excited to see what you guys create with it. It's going to be a game changer. One more way that we are trying to make it easier to transform your business data into data that you can use for your website, and vice versa. Your website's data and every interaction that's made with your website can inform your business data. And the power, like combining that with reporting and all of that is just.










