function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kashyap JoshiKashyap Joshi 

How do I create a formula field on the Case object, that counts the number of customers order

AnkaiahAnkaiah (Salesforce Developers) 
Hi Kashyap,

Can you please explain more about your requirement.?

Regards,
Ankaiah Bandi
Kashyap JoshiKashyap Joshi

Hi Ankaiah,

Actually I need to add Icon on Case by calculating customer order. If Customer have 10 orders then need to display Bronze Icon and if customer ordered less than 10 then display silver,etc 

I have shared screenshot please find below attachment

 


User-added image
Thank You
 

AnkaiahAnkaiah (Salesforce Developers) 
Hi Kashyap,

Is the order count available in account or case?  or you need to calculate number of orders related to account and then populate the icons like Broze, silver etc?

Regards,
Ankaiah 
Kashyap JoshiKashyap Joshi

Hi Ankaiah,

No,first need to count total order for particular customer and then populate icons.

AnkaiahAnkaiah (Salesforce Developers) 
Hi Kashyap,

You need to implement trigger on Case to get the  total order count for particular customer and keep the value in  custom field(total order count). 

Then create a formula field called icon using the custom field(total_order_count__c) as like below.
If(total_order_count__c>=10, 'gold image url',(If(AND(total_order_count__c<10,total_order_count__c>=5), 'silver image url', 'Bronze imageurl'))

Regards,
Ankaiah Bandi


 
Kashyap JoshiKashyap Joshi

Hi Ankaiah,

It is possible to show Icon on Case Summary (Compact Layouts) using custom fields?

 

AnkaiahAnkaiah (Salesforce Developers) 
Hi Kashyap,

Is possible to add the field compact layout but you have limitation to display max 10 fields.

Please refer the below article.

https://help.salesforce.com/s/articleView?id=sf.compact_layout_notes.htm&type=5

Regards,
Ankaiah Bandi
 
Kashyap JoshiKashyap Joshi
Thank You so much Ankaiah for your time and efforts.
Kashyap JoshiKashyap Joshi

Hi Ankaiah,

I have created Formula fields and added condition as you mentions 

If(Order_Count__c>=3, " /resource/bronze",(If(AND(Order_Count__c <3,Order_Count__c>=5), " /resource/silver", " /resource/gold")))

I got below error

Error: Formula result is data type (Text), incompatible with expected data type (number).

can you please guide me with the same

Thank You