Today, United Virtualities’ chief wordsmith Morgan Friedman grabs his favorite coffee cup, throws on his flowerful shirt, and knocks on the digital door of Randy Delfin, a Salesforce Commerce Cloud developer, who opens up about an awesome website that allows you to send flowers of condolences using Salesforce Order Management, SFCC’s out-of-the-box features, and best practices.
(… If videos are not for you, and you prefer the written word, we’ve got you covered. Check out the transcript of the interview below. Enjoy!)
Morgan Friedman: Hey everyone! Welcome to Recursive Business, the UV podcast. Today we have with us a very special guest, Randy Delfin one of our awesome software developers and Salesforce Commerce Cloud expert from Mexico.
Morgan Friedman: So I was talking to Randy the other day about “Mmm, I wanna interview you. Everyone says you’re great. Let’s talk about Salesforce Commerce Cloud” and Randy said “Oh, I want to tell you all about this feature on this nameless website, and they wanted to send people flowers for condolences when they die” I’m like “That’s intense. Thus it’ll be perfect to discuss on Recursive Business, the UV podcast”. So let’s let’s talk about building this feature, Randy. Tell me about the feature, how you built it, how it integrates with Commerce Cloud. Let’s go!
Randy Delfin: This feature was about sending condolences to the family of a dead person or… so it was very interesting how to implement the functionality of sending cards. In Salesforce Commerce Cloud there is an out-of-the-box function for sending these card attached to a product.
MF: It’s interesting that you said that Salesforce Commerce Cloud has a feature to send a card already built in. I hadn’t known that. Before we talk about the changes you made and what you did for this particular client, people dying… intense. Let’s first tell me about the standard feature. Does Commerce Cloud contain that functionality to send cards out of the box automatically?
RD: Yes but the feature was for sending exclusively to some cities of the country, not for all.
MF: So what you’re saying is Salesforce Commerce Cloud lets you send a card, but for the client we needed to only be able to include the card in some cities but not in other cities.
RD: Yes, also only for those gifts that were funerals, marked like funerals.
MF: I see, so only for gifts where the purchaser or the buyer selected that is for a funeral.
RD: Yes and that was the logic I implemented, over the out-of-the-box functionality: To make available the condolence cards only for the cities selected by the client and only for funeral gifts.
MF: I see. So this is, this is very interesting, and this is also a good example of how a little bit of customization can go a long way because often you want a feature that Salesforce Commerce Cloud or your platform has but you need this little change, this little tweak, here only in the city, only for this gift type which is which is what you had to do here, right?
RD: Yes and also the ability to select a special image for the card to accompany the text, your condolence message.
MF: So on the platform we uploaded different images already and the user can select from the different images which one they want?
MF: Was that a built-in functionality automatically or do you need to add that logic as well?
RD: It comes out of the box, but with this context of the functionality, we made a little change to show images exclusively for funerals.
MF: This makes sense, this is a little bit morbid, but that makes it more interesting.
RD: Yes, I think this is a little bit, a detail that makes something special for the affected families.
MF: That is a good point. Because often you can just create an ecommerce platform and just cut and paste, copiar-pegar, and just have, just have another version. But by being able to make these little changes like that you can make it more powerful, just for funerals, just for this purpose.
MF: For this feature, was there any other interesting logic you had to put into this feature or was this the most interesting part?
RD: Yes, well the most interesting part to me in this feature, was to adapt and send the data first and get, for example, if it is a funeral or if the gift in question is for the specific city, and then get this data and by the controller sent to the template. And then inside the template handle the data and build the logic for showing or not showing this kind of card.
MF: So the logic is inside the template itself?
RD: Um, not completely.
MF: You can correct me! You’re the developer, not me!
RD: Not completely. The good practice is to do all the logic inside the controller, however, you can handle a little bit of this logic inside the template.
MF: I see, that’s interesting. I didn’t know that it’s the best practice to put most of the logic in the controller. Why is that considered a good practice?
RD: Okay the good practice in programming is…
MF: This is a test!
RD: It’s a concept that contains different technical ways of programming. The objective is to make the code the thinnest you can, don’t be heavy, and be fast at the wrong time, to make it very readable for other developers that can support you in the future.
MF: This is a great list of some high-level best practices. What I think you’re saying is by putting the logic mostly in the controller it makes it easier for developers to read and it also makes it compile faster, so it runs faster which is why it makes sense to put more logic in the controllers and add templates.
RD: Yes, it’s best practice to put in the controller the most part of the logic because it’s easier for other developers to understand what is happening.
MF: I see, that makes sense. It’s hard to figure out what’s happening in a template. There are lots of “if-thens“ in the template but in a controller to find everything, so it’s clear if the logic is there.
RD: Yes and also putting the logic in the template could make it heavier, because sometimes we cach this template in the instance and the runtime could be heavier to execute because it has a lot of code.
MF: I see, I’m going to translate that into Morgan Language: If you put logic in the template, the caching system could catch the entire template, including all the logic. Meaning it’ll just be a bigger cache file with less memory and slowing it down.
MF: I hadn’t realized that about Salesforce Commerce Cloud. It’s like I’m learning Salesforce Commerce Cloud from you today.
MF: Okay these were two great little lessons. The morbid feature about flowers for dead people and then also there’s best practices, putting the logic mostly in the controllers for readability and speed reasons. This was super super useful. Thank you everyone for watching, I learned these two things from Randy, I hope you did too! To be continued. Bye bye everyone!
RD: Thank you.