Generate Images using AI – Stable Diffusion

Wouldn’t it would be great if we can use an AI program to generate images? As I have embarked on a journey to understand AI & machine learning, wanted to share a quick and fun project that you can run on your local system which can translate your language and generate images accordingly.

Do you know, that the image in my previous post is generated by AI that we would be talking about in this post?

Recently stable diffusion announced its AI module’s public release to be used by developers around the world. In this post, we would be using the same distribution.

Step 1: Prerequisite

  • Install Anaconda distribution from here
  • Make sure you have Git installed as well

20 Steps to Perform Salesforce Healthcheck

You have been working on Salesforce implementation for a long time and as an Architect you need to do X-ray of Salesforce implementation because of

  • Take a decision to decide brownfield vs greenfield implementation
  • Can we bring new business capabilities to existing org
  • Why does it take time to make even more minor changes
  • Why new capabilities break existing functionalities

If your team is facing the above issues, chances are pretty high that you have technical debt in Salesforce, and it’s time to do a health check.

However, how can you do the health check, what are some essential aspects of reviewing your implementation?

In this blog post, I would share some pointers on how health checks can be done. If there are some other areas you think should be considered, please feel free to drop comments in this post.

1. Total Objects in Org

There is a limit of 3000 custom objects, if the total objects are more than 1500, it could be a hint that you have a complex org

2. Records in each org

If you are nearing the storage limit, it’s an indication of a large data volume, and you need to consider an archival strategy.

Scan Barcode in LWC Natively

Barcode in LWC

Around 7 years back I have written this post which shows how Barcode scan can be supported in Visualforce and in aura component with the help of an external javascript library quagga.

Salesforce recently released a new Barcode API which now supports barcode scanning natively on LWC for mobile devices. As it’s supported natively, we don’t need to worry about maintaining 3rd party Javascripts, Locker services, performance issues, etc.

At the time of writing this blog post, around 10 different types of barcodes are supported.

Using Microsoft Adaptive Cards in LWC

Adaptive Cards in Salesforce

There could be a situation in your project where UI components in your application need to be defined at run time where Salesforce may or may not have control. We can solve this situation in LWC using CSS or template:if directive.

There is another alternative to the above problem statement, which can be an extremely lightweight framework from Microsoft – Adaptive cards.

In nutshell, Adaptive cards take a JSON input and convert it to HTML UI elements. In this blog post, I would be sharing simple source code to depict how it works.

5 Steps to increase your chances of passing Certified Technical Architect – CTA certification

5 Steps to pass CTA

As you may have observed, I was on hiatus for the last few months and the reason for that was CTA exam preparation.

The purpose of this blog post is to share my experience and motivate you to embark on this journey.

Lets bust some of the myths around CTA

  • Getting designer certification does not mean you have good platform knowledge. There are many aspects that are not covered in designer exams like Tableau CRM, Heroku, Mulesoft, CPQ, etc
  • Certification is not easy if you are a developer, admin, or consultant. Everyone has something to learn. If you are a good developer then you will need to work on your communication and articulation. If you are a good admin then you would need to learn customization capability etc
  • This exam is easy for a few candidates who are CTO or have 15+ years of experience. That’s not true. Definitely some presale role, Architect & leadership experience will help in exam. EVERYONE that I have met has put hundreds of hours after office & over the weekends. Success may look easy from the outside but behind the scene, it’s a huge effort.

In my opinion, You need to have the right balance of Platform knowledge, Story Articulation capability, Overall strategy, and Time Management, which was my CTA Mantra.

Breaking 5 Myths – Scratch Orgs & Salesforce DX

Its been around 3 years that Salesforce has released new tooling set for developers – Salesforce DX. I’ve been working on Salesforce since days of S-Control around 2008 and have seen extreme changes on platform for better.

To be honest, it’s tough to keep yourself up to date on latest changes that Salesforce has been doing , however there are resources like Medium, Trailhead and many other blogs to help you get up to speed.

I’ve seen days and written code on Force.com IDE, Developer Console, many web based IDE and definitely my heart and love at the moment is with VSCode more importantly Scratch Org & unlocked packages.

Purpose of this blog post is to bust some of myths around using Scratch Org in Salesforce DX however before I start, lets agree on below aspects of project development & management

  1. Most of projects in Salesforce follows Agile and one of most important aspect of Agile is Devops. Your team should spend enough time & energy in planning Devops strategy like branch structure, tools, processes etc. In my experience , Devops is more about process rather than tool.
  2. On basis of above point, Source of truth for code & configuration should be your Source Code Management , which in most of cases is Git.

What if your project is not following above 2 principles ? Well, you might already able to relate some of problems like why code is overwritten , no track of which class or fields created by who and why ? Your team spending most of time fixing deployment issue instead of working on actual implementation.

Lets not spend more time and directly jump on some of myths about using scratch org

Myth 1 – Scratch Org is only for packaging & ISV partners

Scratch Org can be used for quick POC or actual implementations. I’ve been using scratch org for each user story which normally takes 1-3 weeks of implementation. Every time, scratch org created, I get liberty to choose which Git branch would be source of truth. Can you refresh dev pro sandbox from Full copy or use 10 days old code that was in production ? There are many other considerations while creating sandbox, you don’t have much control on which metadata would be carried over as starting point.

Fix Error “Cannot assign to read only property” and print Proxy Object of LWC

As its code-snippet post, its going to be very short but frequently used.

Salesforce decorator @track is reactive , which means if value in JavaScript changes, equivalent HTML UI would also change. You don’t need to mark primitive data types as track, as its enabled by default for them. However for complex structure / object we need to mark variable as @track.

Whenever any JavaScript object marked as @track, Salesforce wraps that object resulting in proxy object. If you try to print that on console, you would not be able to see its value.

That being said, there is no change in way you access it, it’s exactly like any other Javascript object we use. So, if you want to see content of proxy object, just call below method and pass your proxy object.

//Get Javascript object equivalent to Proxy
    proxyToObj(obj){
        return JSON.parse(JSON.stringify(obj));
    }

Another way is, just keep another variable without @track decorator to see content. However problem would be – you need to make sure to keep it in sync every time content of original @track object changes.

Fixing error – Cannot assign to read only property

Above error occurs when we try to change public property on LWC marked as @api

@api someVar
.... some code

somemethod(event){
    //error on below line - Cannot assign to read only property
     someVar.isSelected = true;
}

Above code block would throw an error as we are trying. to change property on object declared by @api

@api someVar
.... some code

somemethod(event){
    //clone @api variable using method we just created
    let tmpObj = this.proxyToObj(someVar);
     tmpObj.isSelected = true;
    //now assign this tmp variable back to original
   someVar = tmpObj;
}

To fix above error, use can do something like