You need to sign in to do that
Don't have an account?
GMASJ
How condition add date condition in SOQL
Hi,
I want to write a login in class. Have a custom object with name Popup_Message__c it has two date fields. Start_Date__c and End_Date__c
Below is the code I have writen I want to display the rows when Start date <= today and do not display the message when end date is set
Example if Start date = 1-May-2019 it must dispaly the message.
if End date is 10-May-2019 it must not display the message
How to add this condition in soql please suggest.
Sud
I want to write a login in class. Have a custom object with name Popup_Message__c it has two date fields. Start_Date__c and End_Date__c
Below is the code I have writen I want to display the rows when Start date <= today and do not display the message when end date is set
Example if Start date = 1-May-2019 it must dispaly the message.
if End date is 10-May-2019 it must not display the message
How to add this condition in soql please suggest.
public class PopupMessageController { @AuraEnabled public static list <Popup_Message__c> fetchMessage() { String profileName = [SELECT Name FROM Profile WHERE Id = :UserInfo.getProfileId() LIMIT 1].name; List<Popup_Message__c> lstOfMsg = [SELECT Message_Text__c, Start_Date__c, End_Date__c, Active_Status__c, Ordering__c, Profile__c FROM Popup_Message__c WHERE Active_Status__c = 'Active' and ( Profile__c = :profileName or Profile__c = null ) and Start_Date__c <= TODAY Order by Ordering__c]; return lstOfMsg; } }Thanks
Sud
Greetings to you!
You can search for null values by using the null keyword. Try like this:
Add other fields and conditions according to your requirement.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
what my understanding is here is that you want to show message when user login which are set in a custom object based on curret user Profile, Can you try to do it with condition Login flows,I haven't tried that yet, but it is suiting your requirement.
Thanks,
Aman