You need to sign in to do that
Don't have an account?
selva kumar 14
Urgent need for SOQL Query
Hi Everyone,
I need to convert this formula to SOQL Query. I have tried in many ways. But it shows parsing error.
Can anyone write me a SOQL Query for this. It would be great help to me.
AND (
AND(
ISBLANK(Last_Stage_Change__c),
NOW() - LastModifiedDate > 30,
Probability < 91,
Probability > 1
),
AND(
NOW() - Last_Stage_Change__c > 30,
Probability < 91,
Probability > 1
)
)
Please help. Thanks in advance.
I need to convert this formula to SOQL Query. I have tried in many ways. But it shows parsing error.
Can anyone write me a SOQL Query for this. It would be great help to me.
AND (
AND(
ISBLANK(Last_Stage_Change__c),
NOW() - LastModifiedDate > 30,
Probability < 91,
Probability > 1
),
AND(
NOW() - Last_Stage_Change__c > 30,
Probability < 91,
Probability > 1
)
)
Please help. Thanks in advance.
To accomplish this via a query you'd need to add two new formula fields:
TimeSinceLastModified__c: NOW() - LastModifiedDate
TimeSinceLastStageChange__c: NOW() - Last_Stage_Change__c
Once you have done this then you can execute the following SOQL query (This is against best practices [1], your best option is to use dynamic SOQL [2] and generate the DateTime you are expecting these fields to be greater than)
[1] https://developer.salesforce.com/blogs/engineering/2013/02/force-com-soql-best-practices-nulls-and-formula-fields.html
[2] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_soql.htm
Thanks for your effort.
But still throws me parsing error on TimeSinceLastModified__c field.
Can any other way to acheive this.