You need to sign in to do that
Don't have an account?

how to show radio button when two fields have same value in lwc
Hi All,
I am new to Salesforce. I am having one requirement where there are 2 date fields if the values of these date fields are the same then show the radio button using LWC.
For eg: if date1 field value = 19/04/2021 and date2 field value = 19/04/2021 then show radio button.
Can anyone please help me with how to achieve it?
Thanks in advance.
Try The Below Code Please Mark It As Best Answer If It Helps
Thank You!
Hi Charu,
Thank you so much, it worked as per my requirement.
I have one more question
how can I use the values of this radio button in my record?
For eg: I have the same dates and I am using the radio button for selecting Half day or full day. If I have selected half-day then it should give me 0.5 as the value in my number of days leaves applied field = 0.5.
Can you please tell me how can I do that
Thanks in advance
Try Below Code I've Made Some Change Let Me Know If This Helps And Don't Forget To Like And Mark It As Best Answer So It Can Help Other
Thank You!
I have tried this code but it is not working as per my requirement. If I have selected half-day still it is giving me no. of days applied=1.
I have one doubt as I have used no. of days leave applied as a formula field because as per my requirement I need to exclude weekends while calculating days after that I am passing the value of this field in trigger for calculating balance leaves and leaves already taken so my concern is if I used radio buttons value it will impact calculation?
no_days =
(IF(AND((5 - (CASE(MOD( fromDate__c- DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD( toDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( toDate__c - fromDate__c) + 1) < 7)),
((CASE(MOD( toDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD( fromDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( toDate__c - fromDate__c ) - (CASE(MOD( fromDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD( fromDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD( toDate__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)))))
this is my formula field. Please let me know if I am missing anything here.
Thanks in advance