web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get Value of the Current Record for FetchXML

(0) ShareShare
ReportReport
Posted on by

I have an Entity B that I open the form to create New from the Contact.  The Contact autopopulates to Entity B.  I have another Entity A that relates to the Contacts via N:N.   I want to get a list of these values with the Contact for my fetchXml.  I have hard coded a value and it works. I have tried #contactid# and it doesn't work and I have tried contactid and it doesn't work either.  Is there anyway to have the value populate with each selected contact?

      <link-entity name="contact" from="contactid" to="contactid" alias="ac">
        <filter type="and">
          <condition attribute="contactid" operator="eq" value= /> 
        </filter>
      </link-entity>


*This post is locked for comments

I have the same question (0)
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Marsox,

    Could you please share some mor edetails? Where/.how are your executing your fetchxml.

  • Verified answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    I am not sure how you are opening the entity B, but if you are adding the contact entity B, you can get the contact value by using Xrm.Page.getAttribute("new_contactid").getValue()[0].id;

    That will give you the contact id value of the lookup on the entity B form.

    Is that what you are looking for? If not, please provide further details.

  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi,

    Please try as @contactid as below:

    <condition attribute="contactid" operator="eq" value= @contactid/>

    Hope this helps:)

  • Verified answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Marsox,

    You can get the current record id by Xrm.Page.data.entity.getId() and below is the code you can use for passing value. like '"+currentrecordID +"'

    function getcurrentid()

    {

    var currentrecordID = Xrm.Page.data.entity.getId();

    <link-entity name="contact" from="contactid" to="contactid" alias="ac">

           <filter type="and">

             <condition attribute="contactid" operator="eq" value= '"+currentrecordID +"' >

           </filter>

         </link-entity>

    }

    Best Regards,

    Shahbaaz

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans