Skip to main content

Notifications

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

Resolve a custom entity in a each loop

Posted on by 5

Hi,

i know this is actually really basic, but it seems somehow i cannot resolve a custom entity in a foreach loop.

I want to get out all the sessions a person is registred with and send it to him, so a rather basic feature. but somehow i allways get a InvalidToken exception.

Here is my code:

    {{msevtmgt_session(ce85e211-66bb-ea11-a812-000d3a654ce0).msevtmgt_name}} {{#each contact.msevtmgt_sessionregistration_contact_msevtmgt_contactid}}
  • {{msevtmgt_session(this.msevtmgt_sessionid).msevtmgt_name}} {{this.msevtmgt_sessionid}}
  • {{/each}}
it seems as if resolving a entity does not work with a variable, but only with text. 
  • piffie Profile Picture
    piffie 5 on at
    RE: Resolve a custom entity in a each loop

    Hey Shavan,

    Actually there is a field in the session registration that should contain the session name, but it seems that microsoft left it blank when making a new session registration.

    I can make an workaround in filling it with a custom workflow, but i believe it rather should be done correctly by microsoft.

    do you think it would be useful to open a ticket here?

    thanks for the workaround answer.

  • Suggested answer
    ShravanSuri Profile Picture
    ShravanSuri 1,255 on at
    RE: Resolve a custom entity in a each loop

    Hey! 

    Couple of points here:

    1. Passing references into a #each loop is not supported.
    2. You can:
      1. Add the fields from the session you want to be added in the email (like session name) into the session registration record (add new fields and actually put the value in, rather than making them calculated fields)
      2. Loop through all session registrations for the contact and based on the event that email is about, put in the details of the corresponding sessions

        
        
      3. {{this.session_name}}

    I understand that the process is a bit involved (with the extending the session registration entity and copying some data, but this should get you unblocked.

    Thanks,

    Shravan

    PM, D365 Marketing

  • piffie Profile Picture
    piffie 5 on at
    RE: Resolve a custom entity in a each loop

    Hi Shailesh,

    Yes. for all the Sessions a person registered for.

    As we have a strict policy that you only can enter these sessions, and sponsors can nominate people in advance it is important to tell them where they will have access to.

    thanks.

  • ShaileshJain Profile Picture
    ShaileshJain on at
    RE: Resolve a custom entity in a each loop

    Hi Christoph - can you please confirm what is the business scenario here:

    Seem like, you are trying to compose an email with list of all events the recipient has registered for?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans