You need to sign in to do that
Don't have an account?
The new Learner
How to filter long text area in test class
Hi Experts,
I have small requirement where i need to filter a long text area field called Desc__c which i am not able to do that can anyone help me please.
OrderItem oli1 = new OrderItem ();
oli1.Orderid = order.Id;
oli1.Desc__c= 'Test OLI 1';
insert oli1;
OrderItem oli2 = [SELECT Id, Orderid
FROM OrderItem WHERE Desc__c = 'Test OLI 1' LIMIT 1];
In this filter condition its throwing an error can anyone help me please thanks in adavance
I have small requirement where i need to filter a long text area field called Desc__c which i am not able to do that can anyone help me please.
OrderItem oli1 = new OrderItem ();
oli1.Orderid = order.Id;
oli1.Desc__c= 'Test OLI 1';
insert oli1;
OrderItem oli2 = [SELECT Id, Orderid
FROM OrderItem WHERE Desc__c = 'Test OLI 1' LIMIT 1];
In this filter condition its throwing an error can anyone help me please thanks in adavance
All the orderItems with 'Test OLI 1' in desc__c will be added to the list 'oli2'.
All Answers
We cannot apply filter on long text area. So my suggestion is to go with the below solution: If you only need first record (LIMIT 1):
Hope this will be helpful;
Thanks
Bhargavi.
If i have multiple records then do i need to do that , can you help me please
All the orderItems with 'Test OLI 1' in desc__c will be added to the list 'oli2'.
Thanks alot , in case of formula field how do i need to approch for this kind of sceario pls
If you only need to update a formulae field then my choice is to :
Use a workflow which updates a text area field with the value of long text area field.We can use the text area field in the formulae field.
This might be the solution your expecting for but we dont have a choice to use long text area fields in formulae.
Thanks
Bhargavi.