cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to find the record ID from sales force from a given variable

Hi, 

 

I want to make a system where after an email is received to a specific account send an email with a form.  My actual idea is that with some of the information captured from the form use it as a reference for pulling out data from a salesforce record and then using that data for some further validations. I am struggling in how to get the record ID. 

 

image.png

 

For example that with an email (that would be captured from the Form sended to the user), being able to retrieve and capture some User Data from sales force for the specific record that contains the submitted email in the form. Is that possible? What is the best way for doing so? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to find the record ID from sales force from a given variable

Ok, your issue is you are not using "Get Records" you are using "Get Record". These are not the same.


Here is how you do it. Using the get records action filter so that email equals the "From" field from the email arriving trigger.

The syntax is using OData. In this case I used Email eq 'From'. Please note that I have single quote marks around the From field.

2019-07-22_17-29-13.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If there is a user or users within Salesforce that have this email it will return it. 

Next to make sure it works I will send an email with the user's full name in the body.

 

Snag_1b62ebd6.png

 

 

 

 

 

 

 

 

 

 

 

Now as soon as you put "Full Name" in the body of the email it will automatically put the entire email step in an "Apply to Each" loop. That is because the "Get Records" step could return multiple users. If it returned 6 users it would loop through the email step 6 times sending an email for each user that it found. 

Here is what my whole Flow looks like:

 

2019-07-22_17-35-33.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now if I trigger this flow I get 2 emails because there are 2 users in the system with the same email:

 

Snag_1b677640.png

View solution in original post

3 REPLIES 3

Re: How to find the record ID from sales force from a given variable

You need to pull in the Salesforce user record from somewhere. Is the email address that the email comes from the email of the user record?

If it is you can use this to find the record in Salesforce. Use "Get Records" and filter to where the user record has a matching email address. You can then store the Id of the user record and use it later.

Anonymous
Not applicable

Re: How to find the record ID from sales force from a given variable



@danmitchell36 wrote:

You need to pull in the Salesforce user record from somewhere. Is the email address that the email comes from the email of the user record?

If it is you can use this to find the record in Salesforce. Use "Get Records" and filter to where the user record has a matching email address. You can then store the Id of the user record and use it later.



Yeah absolutely, the email from the one who sent it could be the one of the user record...

 

I understand what you are saying, I just don't know quite accurately how to do it, getting started with it. 

image.png

This are the only fields for the get records function in sales force. The record ID is a required field, should i make the filter inside that field? For example something like:  

 

equals(body('Get_record')?['Email__c'], triggerBody()?['From']
 
(Not sure with the "Body" after the equals) but anyways, was something similar to this what you suggest?

 image.png

 

I had no clear idea of how to develop the solution. I really appreciate the help!
Highlighted

Re: How to find the record ID from sales force from a given variable

Ok, your issue is you are not using "Get Records" you are using "Get Record". These are not the same.


Here is how you do it. Using the get records action filter so that email equals the "From" field from the email arriving trigger.

The syntax is using OData. In this case I used Email eq 'From'. Please note that I have single quote marks around the From field.

2019-07-22_17-29-13.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If there is a user or users within Salesforce that have this email it will return it. 

Next to make sure it works I will send an email with the user's full name in the body.

 

Snag_1b62ebd6.png

 

 

 

 

 

 

 

 

 

 

 

Now as soon as you put "Full Name" in the body of the email it will automatically put the entire email step in an "Apply to Each" loop. That is because the "Get Records" step could return multiple users. If it returned 6 users it would loop through the email step 6 times sending an email for each user that it found. 

Here is what my whole Flow looks like:

 

2019-07-22_17-35-33.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now if I trigger this flow I get 2 emails because there are 2 users in the system with the same email:

 

Snag_1b677640.png

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,143)