@aluzaja178
what do you mean “dynamic”? As in search other fields? Can you show your server-side code, please.
Thanks
Thank you for your quick response Alexa.
i mean whatever i enter into textbox, that value should be placed in parameter attribute like this parameters=”{“email”: “mytextboxvalue”}”.
@aluzaja178
request parameters are available in twig as request.params collection as documented, so value should be something like request.params['email']
HTH
Sorry, i am new to twig and the guide is very light on it.
unfortunately, twig tag is rendering as plain text instead of view. please see my code below
This is my “func.php” file
<?php echo do_shortcode("[msdyncrm_twig]
{% fetchxml collection='contacts' cache='PT30M'S %}
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='contact'>
<attribute name='fullname' />
<attribute name='emailaddress1' />
<attribute name='contactid' />
<order attribute='lastname' descending='false' />
<filter type='and'>
<condition attribute='emailaddress1' operator='eq' value='[email protected]'/>
</filter>
</entity>
</fetch>
{% endfetchxml %}
<ul>
{% for contact in contacts.results.entities %}
<li><a href='{{ entityUrl( 'contact', contact.id ) }}'>{{contact.fullname ?? '[noname]' }}</a> <{{contact.emailaddress1}}></li>
{% endfor %}
</ul>
[/msdyncrm_twig]"); ?>
Here is my Function.php file code where i am including func.php file
require get_template_directory() . '/inc/myfunc.php';
@aluzaja178
can you try, instead of rendering [msdyncrm_twig] via a do_shortcode call, just add it to the page content (with hardcoded email for now)?
Does it render?
Yes it worked fine when i put it in content page. But do_shortcode renders it in plain text.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
@aluzaja178 Unless you are reporting yourself as a spammer, do not use the Report this topic link. That link is not a magic “get fat support” link, its to locate and ban spammers and abusers.
If you by some strange coincidence are reporting yourself for that then I’ll ban your account for abuse. But I doubt that’s the reason.
@aluzaja178
not sure why do_shortcode does not work for you but before we investigate, why don’t you try building fetch inline?
`
[msdyncrm_twig]
{% set emailparam = query.params[’email’] %}
{% fetchxml collection=’contacts’ cache=’PT30M’S %}
<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’true’>
<entity name=’contact’>
<attribute name=’fullname’ />
<attribute name=’emailaddress1′ />
<attribute name=’contactid’ />
<order attribute=’lastname’ descending=’false’ />
<filter type=’and’>
<condition attribute=’emailaddress1′ operator=’eq’ value='{{ emailparam }}’/>
</filter>
</entity>
</fetch>
{% endfetchxml %}
[/msdyncrm_twig]
Thank you Alexa Team, that issue is already fixed. Everything was fine except one issue. i was including my file at wrong location in functions.php.