Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

WorkflowElements Query Get Results

Posted on by Microsoft Employee

I have got following problem:

I would like to retrieve some data using Query Get Results and FetchXML field. These are my dynamics filters:

This filter I am getting using Get Record ID from WorkflowTools:

<filter type="and" >
   <condition attribute="opportunityid" operator="eq" value="{Record ID(Oppt ID)}" />
</filter>

or

<filter type="and" >
   <condition attribute="opportunityid" operator="eq" value="{Record URL(Dynamic)(Opportunity)}" />
</filter>

Both filters do not work -> Query Get Results throws an error. If I filter using hard coded GUID then it works. What is the problem?

 

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WorkflowElements Query Get Results

    Hi Aiden,

    This is fine for me.

    Best,

    Maris

  • Suggested answer
    AidenKaskela Profile Picture
    AidenKaskela 15 on at
    RE: WorkflowElements Query Get Results

    Hi Maris,

    Unfortunately, if you want to pull in 5 different fields from some record, you'll need to call the query 5 times and just specify one attribute in each call. Then where you need to use the result, you can access the single value from the 'Single Value' output parameters on each step. I couldn't think of a friendly way to query for a bunch of fields and allow the user to access some of them (I could return it as json and let the user parse it out in a different but I was going to a non-tech solution).

    Thanks,

     Aiden

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WorkflowElements Query Get Results

    Hi Aiden,

    This is magic!

    I have used yr approach as on the screenshot and it works great. I have created a Fetch to retrieve only one field value and I could get this value from the required record. Could you pls help me if I need to retrieve more than one field values using one FetchXML. I create a FetchXML to get some field values but how can I access separate fields by output?

    I will try yr proposal with a note with a Fetch.

    Thanks

    Maris

  • Suggested answer
    AidenKaskela Profile Picture
    AidenKaskela 15 on at
    RE: WorkflowElements Query Get Results

    Hi Maris,

    Thanks for checking out Workflow Elements.

    If you are retrieving records that are related to your workflow record, I'd suggest limiting them using the 'Contains Data' notation documented here: https://kaskelasolutions.com/how-to-limit-query-result-to-related-records/ You can do the same thing in your FetchXml so you don't need to hardcode the ID - I'm attaching a screenshot of an example from the opportunity product to opportunity.

    pastedimage1588272423922v1.png

    There are some cases where you want to query for records that aren't related to your record but you know the ID, that's the only time you're need to do your first example value="{Record ID(Oppt ID)}" /> That is the correct notation and should give you results. What's happening when you do it now? To troubleshoot, you can do something like create a note where the text is the same as the Fetch you're building up to see how it actually evaluates at runtime.

    Hope this helps! If not, let me know and we can dig a little deeper. If this solves your issue, I'd appreciate if you'd mark as verified.

    Thanks,

      Aiden

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans