# Einstein.ExecuteLens

This method requires parameters as explained below.

Parameters:

| Parameter | Sample Value                                             | Info                                    |
| --------- | -------------------------------------------------------- | --------------------------------------- |
|           |                                                          |                                         |
| Lens      | Historical Pipeline Stage by Quarter (VoiceworxSalesApp) | Choose the required lens from dropdown. |

Other than these two parameters, you need to provide following standard inputs

| Parameter             | Info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Method Name           | You can give any name. This name will be displayed in the methods list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Request Type          | <p><strong>Einstein.ExecuteLens</strong></p><p>This is the method that you are using</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Parameters            | As explained in the previous table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Result Type           | <p>ListOfRecords (Auto Selected)</p><p>It indicates that the method can return one or more records</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Record Limit          | <p>Numeric value (e.g. 10)</p><p>If Method is returning larger number of records, then you can limit this result by providing this value.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Record JsonPath       | <p>Each method returns data in json format and to pick any specific information from the json, we need to specify the <em>Record JsonPath</em> so Voice Worx platform will pick that data in consideration while displaying results.</p><p>Example: $.results.records\[\*]</p><p>This selects all the records that is returned.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Empty Result Template | <p>When the method does not return any data, this response will be generated. So we can specify something like:</p><p>“Sorry, I could not find the data”</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Record Template       | <p>Let’s assume that the following json represents a record.</p><p>{</p><ul><li>"action" : query,</li><li>"responseId" : 4ZYb6WZm8DGZp\_0fHwqHSV,</li><li><p>"results" : -{</p><ul><li>"metadata" : +\[ ... ],</li><li><p>"records" : -\[</p><ul><li><p>-{</p><ul><li>"Quarter" : This Quarter,</li><li>"StageName" : Prospecting,</li><li>"stage\_sort" : 1,</li><li>"sum\_Amount" : 24597662,</li><li>"time\_sort" : 1</li></ul></li></ul></li></ul></li></ul><p>},</p><ul><li><p></p><ul><li><p></p><ul><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... },</li><li>+{ ... }</li></ul></li></ul></li></ul><p>]</p><ul><li>},</li><li>"query" : q = load "0Fb2w000000HGNMCA4/0Fc2w000002C0f9CAC";\nq = filter q by 'Stage.IsClosed' == "false";\nq = filter q by 'ForecastCategory' != "Omitted";\ntoday = filter q by 'IsLastUpdate' == "1";\ntoday = group today by 'StageName';\ntoday = foreach today generate 'StageName' as 'StageName', sum('Amount') as 'sum\_Amount', last('Opportunity.Stage.SortOrder') as 'stage\_sort', 0 as 'time\_sort', "Current" as 'Quarter';\none = filter q by (date('ValidFromDate\_Year', 'ValidFromDate\_Month', 'ValidFromDate\_Day') in \[.."1 quarters ago"]) && (date('ValidToDate\_Year', 'ValidToDate\_Month', 'ValidToDate\_Day') in \["current quarter"..]);\none = group one by 'StageName';\none = foreach one generate 'StageName' as 'StageName', sum('Amount') as 'sum\_Amount', last('Opportunity.Stage.SortOrder') as 'stage\_sort', 1 as 'time\_sort', "This Quarter" as 'Quarter';\ntwo = filter q by (date('ValidFromDate\_Year', 'ValidFromDate\_Month', 'ValidFromDate\_Day') in \[.."2 quarters ago"]) && (date('ValidToDate\_Year', 'ValidToDate\_Month', 'ValidToDate\_Day') in \["1 quarter ago"..]);\ntwo = group two by 'StageName';\ntwo = foreach two generate 'StageName' as 'StageName', sum('Amount') as 'sum\_Amount', last('Opportunity.Stage.SortOrder') as 'stage\_sort', 2 as 'time\_sort', "1 quarter ago" as 'Quarter';\nthree = filter q by (date('ValidFromDate\_Year', 'ValidFromDate\_Month', 'ValidFromDate\_Day') in \[.."3 quarters ago"]) && (date('ValidToDate\_Year', 'ValidToDate\_Month', 'ValidToDate\_Day') in \["2 quarters ago"..]);\nthree = group three by 'StageName';\nthree = foreach three generate 'StageName' as 'StageName', sum('Amount') as 'sum\_Amount', last('Opportunity.Stage.SortOrder') as 'stage\_sort', 3 as 'time\_sort', "2 quarters ago" as 'Quarter';\nfour = filter q by (date('ValidFromDate\_Year', 'ValidFromDate\_Month', 'ValidFromDate\_Day') in \[.."4 quarters ago"]) && (date('ValidToDate\_Year', 'ValidToDate\_Month', 'ValidToDate\_Day') in \["3 quarters ago"..]);\nfour = group four by 'StageName';\nfour = foreach four generate 'StageName' as 'StageName', sum('Amount') as 'sum\_Amount', last('Opportunity.Stage.SortOrder') as 'stage\_sort', 4 as 'time\_sort', "3 quarters ago" as 'Quarter';\nresult = union today, one, two, three, four;\nresult = group result by ('Quarter', 'StageName');\nresult = foreach result generate 'StageName' as 'StageName', 'Quarter' as 'Quarter', sum('sum\_Amount') as 'sum\_Amount', first('stage\_sort') as 'stage\_sort', first('time\_sort') as 'time\_sort';\nresults = order result by ('time\_sort' desc, 'stage\_sort' asc);,</li><li>"responseTime" : 114</li></ul><p>}</p><p>In this example, you want to access the items of records array,</p><p>So record template can be written as</p><p><em>{{StageName}}, amount {{sum\_Amount}}</em></p><p>Note:</p><p>Anything written in between {{ }} is represented as a json field and it’s case-sensitive.</p><p>{{StageName}} is not same as {{stagename}}</p> |
| Result Template       | <p>This indicates how method results should be represented.</p><p>Here you go, We have found the following historical pipeline by stage, {{Records}}</p><p>Here, {{Records}} represents one or more records separated by a separator.</p><p>Now the response looks like:</p><p>I have found the following historical pipeline by stage, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060, Value Proposition, amount 29715331, Perception Analysis, amount 38981892, Proposal/Price Quote, amount 15889140, Negotiation/Review, amount 17044891, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc/general/edit-custom-apps/methods/data-source-salesforce/einstein.executelens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
