• Resolved aluzaja178

    (@aluzaja178)


    Hi,

    I need help regarding CRM integration with my WordPress site. I have one textbox and one button named as “Search”. i need to search my CRM data by putting email as a parameter from my textbox. Its working fine by hard-coding “email” parameter.

    is there any guide available to make this parameter dynamic ?

    Kindly help me out in this regard.

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author alexacrm

    (@alexacrm)

    @aluzaja178

    what do you mean “dynamic”? As in search other fields? Can you show your server-side code, please.

    Thanks

    Thread Starter aluzaja178

    (@aluzaja178)

    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”}”.

    Plugin Author alexacrm

    (@alexacrm)

    @aluzaja178

    request parameters are available in twig as request.params collection as documented, so value should be something like request.params['email']

    HTH

    Thread Starter aluzaja178

    (@aluzaja178)

    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='info@southridgevideo.com'/>
      
     </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';

    Plugin Author alexacrm

    (@alexacrm)

    @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?

    Thread Starter aluzaja178

    (@aluzaja178)

    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.

    Plugin Author alexacrm

    (@alexacrm)

    @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]

    Thread Starter aluzaja178

    (@aluzaja178)

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Search Functionality by Putting Parameters from Textbox’ is closed to new replies.