function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jcookejcooke 

Formula question

Hi, I have a question about a formula. We have a formula in Salesforce that shows the roles that should come over to Parature (we have a integration tool that brings over these roles) it was working fine with Primary Technical Contact and Customer portal viewer, but we just recently added two new roles of SW and FB Primary Technical.

 Formula  
 
 
IF(includes( Role__c ,"Primary Technical Contact"),"Account Reviewer",
IF(includes( Role__c ,"SW Primary Technical Contact"),"Account Reviewer",
IF(includes( Role__c ,"FB Primary Technical Contact"),"Account Reviewer",
IF(includes(Role__c,"Customer Portal Viewer"),"Customer Limited",
IF(includes(Role__c,"Left the Company"),"Trashed",
"No Access"))
)))

 

In our Parature Connect tool we have this where statement, but we need to include SW Primary Technical Contact and FB Primary Technical Contact in the role section . How can we include it in this statement below.

I have tried just adding the two new roles to it, but I keep receiving errors and Parature support cannot help us.

 

(((account.type='active' or account.type='partner' or
(account.type='inactive' and account.parasf__parature_sandbox_id__c != null))
and email !=null
and role__c includes ('primary technical contact','SW Primary Techncial Contact', FB Primary Technical Contact','customer portal viewer'))
or parasf__parature_sandbox_id__c != null

)

and role__c includes ('primary technical contact','customer portal viewer'))

 

The error I receive now is There was a problem querying Salesforce with the query items specified. Please review your query parameters. The error from Salesforce was: MALFORMED_QUERY: )) ORDER BY lastmodifiedDate ^ ERROR at Row:7:Column:28 line 7:28 mismatched character '' expecting '''

 

Any ideas?

Thanks

werewolfwerewolf

First:

 

What exactly does the formula field have to do with the query?  They seem to be gathering similar stuff but they're 2 different things.

 

Next:

 

Rather than writing that whole big query, if your formula field is working, then why do you not just put "MyFormulaField__c != 'No Access' in your where clause?  That way if you ever add another role you need only add it to that formula field and the query will reflect it transparently.  Plus it'll fix your current problem.

 

And:

 

Did you copy that query from your code verbatim?  There seem to be typos in it.  The one causing the error is that FB Primary Technical Contact' is missing the open quote prior to it (the error message here is fairly precise and correct), but also SW Primary Techncial Contact has the word "Technical" misspelled in it.

 

Finally:

 

As I mentioned, you should nix this part of the where clause altogether and use the formula instead to avoid typo issues like this one.

jcookejcooke

This is what I added now in the where statement of the tool and I receive a smaller error not sure if it needs another parathese? The only two new additions were sw primarty technical contact and fb primary technical contact.

 

 ERROR: There was a problem querying Salesforce with the query items specified. Please review your query parameters. The error from Salesforce was: MALFORMED_QUERY: unexpected token: )

 

(((account.type='active' or account.type='partner' or
(account.type='inactive' and account.parasf__parature_sandbox_id__c != null))
and email !=null
and role__c includes ('primary technical contact', 'sw primary technical contact', 'fb primary technical contact', 'customer portal viewer')))
or parasf__parature_sandbox_id__c != null

)
)

werewolfwerewolf

Once again, the error message tells you exactly what's wrong.  Tabifying your query with a sticky-tab editor like Notepad++ gives you:

 

(
    (
        (
            account.type='active' or account.type='partner' or
            (
                account.type='inactive' and account.parasf__parature_sandbox_id__c != null
            )
        )
        and email !=null
        and role__c includes
        (
            'primary technical contact', 'sw primary technical contact', 'fb primary technical contact', 'customer portal viewer'
        )
    )
)
or parasf__parature_sandbox_id__c != null

)
)

 

Clearly showing that you have way too many close parentheses.

Message Edited by werewolf on 11-30-2009 01:41 PM