Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jennifer_siders
Contributor III
Contributor III

How to design the flow if there are no records from a Salesforce Query.

Hi All,

 

I have a simple requirement, where if a query(tSalesforceinput) doesn't return any value then follow step 1 and if it returns a value, then follow step 2. Here step1 and step 2 are creating a record using tsalesforceoutputbulkexec.

 

I tried using expression filter in tMap_2, where if Id==null, then take step2, and if id != null take step1 but this doesn't seem to work.

0683p000009MaEH.jpg

Labels (2)
1 Solution

Accepted Solutions
Jennifer_siders
Contributor III
Contributor III
Author

7 Replies
Jennifer_siders
Contributor III
Contributor III
Author

Solved
JohnRMK
Creator II
Creator II

Hello,

 

The best way to do this is to have a simple query like "SELECT Id FROM SF_OBJECT LIMIT 1"

send this to a tHashouput 

 

tHashoutput-->if trigger NB_LIGNE >0 ==>tSalesforceInput-->tSalesforceOutput

tHashoutput-->if trigger NB_LIGNE = 0 ==>tSalesforceInput-->tSalesforceOutput

Jennifer_siders
Contributor III
Contributor III
Author

Thanks @JohnRMK 

 

I think i am stuck...when i tried..so as below, i have tsalesforceinput which returns ID and i belive it is stored in thasoutput....however if there are no records via query component, thashoutput will not have any value. If there are no records in tsalesforceinput, i want system to take different path

 

0683p000009MaOg.jpg

JohnRMK
Creator II
Creator II

Hello,

 

Here you find a sample design for your case

0683p000009MaUO.png

 

If there is a record you will execute the green sub-job or if the query doesn't return a record, then, you will execute the red sub-job

Jennifer_siders
Contributor III
Contributor III
Author

Hello @JohnRMK  Thanks a lot for taking time and preparing the sample. It has saved a lot of time!

 

 

 

0683p000009MaOW.png

 

When there are no records, it comes via ORDER.2 which is correct. However, i dont need to run a tSalesforceInput_3, as the input for tSalesforceOutputBulkExec_1 comes from various other global variables. So how do i pass that data to Create_1. When i tried with above flow, in tMap_6, i have directly provided globalvariables reference to tSalesforceoutputbulkexec 

 

My tmap_6 between tSalesforceinput_3 and tSalesforceoutputbulkexec_1 looks like this... not sure if that's the correct way

 

0683p000009MaUT.png

JohnRMK
Creator II
Creator II

Hey, 

 

You can use tFixedFlowInput to send a single record with all global variable  like this 

 

0683p000009MaPu.jpg

 

Bus one record per iteration and i advice you to use tha sample tSalesforceOutput instead of the bulk who is design to deal with Millions of records.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Jennifer_siders
Contributor III
Contributor III
Author

Lovely! It worked. Thanks for saving my time as i was struggling being from a non programming background. Have a nice day.