Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

SOQL Query for Specific Data

allwynbazil
8 - Asteroid

Team,

 

I would like to run the SOQL query to fetch the SFDC case information for specific cases. Currently, I am running the entire case information to compare them with my cases and filtering them based on CASE NUMBER. Is there a way to run the query only for specific cases? I have created a Cnos column that can be used in the Where condition in the SOQL query. However, I am unsure how to use this Variable or Column there in the SOQL query as there is no way to link my inputs to the Salesforce Input component. Example code below.

 

SELECT
Id,CaseNumber,
Opportunity_ID__c,
Opportunity_ID__r.Id,
Opportunity_ID__r.Name,
Opportunity_ID__r.Account.Name,
Opportunity_ID__r.Owner.Namefrom
Case
WHERE 

CaseNumber in Cnos

 

Regards,

Alwin

7 REPLIES 7
Felipe_Ribeir0
16 - Nebula

Hi @allwynbazil 

 

You can do it using the summarize/dynamic input tool:

 

1-Concatenate your field to be used inside of a IN clause:

 

Felipe_Ribeir0_3-1673276364103.png

 

 

 

Felipe_Ribeir0_0-1673276257978.png

2-replace the concatenated field inside of the dynamic input tool:

 

Felipe_Ribeir0_1-1673276300039.png

 

Felipe_Ribeir0_2-1673276329879.png

 

Take a look at the attached example

 

 

 

n8rushton
Alteryx Alumni (Retired)

Hi, I have had some luck with dynamic sqls making a connector nested within a macro. You can prepare a few steps before hand to modify the sql with simple formula tools and creating an in() statement with a concatenate on a summary tool. If you provide a dataset I can show you.

allwynbazil
8 - Asteroid

Hi Felipe,

 

My requirement is for Salesforce Input Component. Is there a way include my concatenated column in SOQL query?

allwynbazil_1-1673276791731.png

 

Regards,

Alwin

 

 

Felipe_Ribeir0
16 - Nebula

Hi @allwynbazil 

 

Got you! Yes, you can do it by building a macro like this (but with the salesforce input tool on the place of the input tool):

 

Felipe_Ribeir0_0-1673277713866.png

 

And then using the update component to update the where clause:

 

Felipe_Ribeir0_1-1673277745047.png

 

 

Your main workflow would look like this:

 

Felipe_Ribeir0_2-1673277828481.png

 

 

Here is how to build where clauses for Salesforce SOQL

 

https://developer.salesforce.com/forums/?id=906F00000008ruyIAA

 

allwynbazil
8 - Asteroid

Thanks, Felipe. I will try and let you know. Appreciate your quick response.

 

Regards,

Alwin

allwynbazil
8 - Asteroid

Hi @Felipe_Ribeir0 

 

I am sorry. I am unsure about macro and how to use it as you suggested. Can you please show me an example of the case numbers below for my query?

 

20515812201
20515721001
20515782901
20515813501
20594086004
20515815101

 

SELECT
Id,CaseNumber,
Opportunity_ID__c,
Opportunity_ID__r.Id,
Opportunity_ID__r.Name,
Opportunity_ID__r.Account.Name,
Opportunity_ID__r.Owner.Name
from
Case
WHERE
CaseNumber in Cnos

 

Regards,

Alwin

Felipe_Ribeir0
16 - Nebula

Hi @allwynbazil 

 

Unfortunately i dont have Salesforce here right now to test it, but here it is what i think that would work. Download the attached workflow, enter inside the macro, log in your salesforce environment, do the bellow config, save the macro and try to run it.

 

Felipe_Ribeir0_0-1673284153028.png

 

 

Labels