1

I'm trying to write a trigger that unlocks order records after they are placed in an approval process. The Trigger pulls a list of all orders where the CreatedDate = TODAY and the Submitted_Date_Time__c field is not blank, however my AND statement is breaking it and I'm not sure how to write it.

Any thoughts?

The error is:

Error: Compile Error: Unexpected token '<'. at line 3 column 5

This is what works:


//Get records to unlock

List<order> orderList = [SELECT Id From Order WHERE CreatedDate = TODAY ];

//Check locked records

List<order> orderLockList = new List<Order>();

for(Order c :orderList){

if(Approval.isLocked(c.id)){

orderLockList.add(c);

This is what I want but causes the error:


//Get records to unlock

List<order> orderList = [SELECT Id From Order WHERE CreatedDate = TODAY AND !isBlank(Submitted_Date_Time__c) ];

//Check locked records

List<order> orderLockList = new List<Order>();

for(Order c :orderList){

if(Approval.isLocked(c.id)){

orderLockList.add(c);

1 Answer 1

2

isBlank can't be used in a SOQL query.

You should do something like:

List<Order> orderList = [SELECT Id 
                         FROM Order 
                         WHERE CreatedDate = TODAY AND
                               Submitted_Date_Time__c != NULL 
                        ];
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .