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)

How do i filter the edit action in my entity list to redirect to the correct web-page+form?

(0) ShareShare
ReportReport
Posted on by

Hello Dynamics-gurus!

I'm working on setting up a customer self-service portal, and have encountered an issue I cannot seem to figure out on my own. I currently have an entity list displaying cases from two different entity forms, containing different fields. This number may well increase in the future. My problem is that I want these forms to be editable - which I have set up, where the edit button redirects to a web-page with the edit-form to the entity form in question. But as I have more than 1 form in the list, I cannot figure out how to avoid having multiple edit-buttons, each redirecting to the set form. What I actually want is that the edit-button be filtered, or perfom a check as to which form is listed, so that the edit-button redirects to the correct form.

So in short, I currently have 1 entity list, with 2 entity forms. I also have 2 edit-buttons, both displaying at once regardless of type of form. My wish is to only have 1 edit-button, that is displayed by "checking" which form is listed.

Entity-list.PNG

As the image displays I have 1 edit-button and 1 view details-button. I have done this so I can differentiate the two edit-functions while working on figuring out how to solve this issue.

How do I go about solving this?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nick.Doelman Profile Picture
    1,947 Most Valuable Professional on at

    I am assuming that what you want is based on the case type you want a specific edit form to appear?

    e.g. "Blue" cases open up the "Blue" form and "Red" cases open up the "Red" form?

    Both Blue and Red cases appear in the same entity list?

    I think what I would do is instead of using entity forms, have the edit link go to a pagew with a webform process, and use the "condition" step to redirect to either of your entity form pages.  (assuming you have field that differentiates the case types)

    The caveat is that using the CRM Online portals you can't start webforms with the condition step so you need to show a page with a "click next" button to move to the second step where you have the condition.

    Hope that helps!

    Cheers

    Nick  

  • Verified answer
    Colin V Profile Picture
    on at

    Hi Ariel, you can do this with some JavaScript or using the new filter criteria for entity grid actions.  The filter criteria is new as of portals 8.2 so you might not have that version.

    For the JS route you want to configure 2 edit actions and then on load of the entity list parse through each result and show/hide one or the other edit actions.

    There is an event of the entity list load that you can hook this into.  Here is a sample as well as the documentation of the entity list loaded event

    https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/entity-list/attributes-relationships/#CustomJavaScript

    This sample fires on load of a certain entity list, iterates through the results on the page and checks a field/column value then hides certain actions based on the status.

    $(".entitylist.entity-grid.EntityListA").on("loaded", function () {
            $(this).children(".view-grid").find("tr").each(function () {
                if ($(this).find('[data-attribute="statuscode"]').attr("data-value")) {
                    var val = JSON.parse($(this).find('[data-attribute="statuscode"]').attr("data-value")).Value;
                    if (val == 845280006)//Closed
                    {
                        $(this).find('.dropdown.action [data-workflowid="3a45ae5a-2011-44e6-a039-80caf43e785b"]').hide();
                        $($(this).find('.dropdown.action .edit-link').get(0)).hide();
                    }
                    else if (val == 845280002 || val == 845280004)//pending || approved
                    {
                        $(this).find('.dropdown.action [data-workflowid="c7dcf9c6-eaed-40e1-8f2d-8f3e994d17dd"]').hide();
                    }
                }
    
                if ($(this).find('[data-attribute="adoxio_profileexpirydate"]').attr("data-value")) {
    
                    if (Date.parse($(this).find('time').text()) > Date.today().add({ days: 30 })) {
                        $($(this).find('.dropdown.action .edit-link').get(1)).hide();
                    }
                }
                else {
                    if ($(this).find('.dropdown.action .edit-link').get(1)) {
                        $($(this).find('.dropdown.action .edit-link').get(1)).hide();
                    }
    
                }
            });
        });


  • Community Member Profile Picture
    on at

    Hello Nick and Colin, and thank you for the quick responses!

    I should have pointed out in the original post that I do Indeed have the latest version, and thus the "Filter Criteria" is available to me - I just couldn't find any documentation on how to use it.

    Even though both of your replies sort of answer my question, I had hoped there would be a simpler way of going about this. I and not very proficient in JavaScript, and as such I was hoping there would be a configurable way of giving the edit button a "if-then" functionality.

    Using web-forms instead of an entity form sounds like a possible workaround, but adding additional steps just to run the "condition-check" makes it alot less appealing. Am I "forced" to make use of JavaScript to accomplish what I want in regards to the edit button leading to one form or the other?

  • Nick.Doelman Profile Picture
    1,947 Most Valuable Professional on at

    I can't comment on the "filter criteria" because that is new to me too (everytime Colin posts something I learn something)

    I don't think you are "forced" into one way or the other.  There are always different ways to solve these types of problems, you just have to brainstorm and get creative.  In your case you could have 2 seperate entity list pages for each type of case (not ideal, but just an idea) or with liquid, 2 seperate entity lists can be shown on a single page, more work (and fancy liquid) but you might avoid javascript.

    Those are just my quick thoughts... other folks might chime in as well.

    Cheers

    Nick

  • Fubar Profile Picture
    2,761 on at

    Colin,  do you have an example of what would go into the 'filter criteria' - as we have see it there but haven't been able to find any documentation

  • Colin V Profile Picture
    on at

    There is unfortunately nothing documented yet and my guess is apparently not right or its just not working in general.  I will see if I can get the status of this feature and an example of it.

  • Colin V Profile Picture
    on at

    Documentation is pending for this functionality but a friend let me know that you can find an example of filter criteria in the entity form Opportunity Details for the Partner Portal.  It requires the full fetchxml statement, I was expecting only the filter part of the fetch.  With the full fetch this potentially makes it even more robust.  Example from the opp details entity form:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" no-lock="true">
        <entity name="opportunity"> 
            <filter type="and"> 
                <condition attribute="statuscode" operator="in"> 
                    <value>100000003</value> 
                    <value>1</value> 
                </condition> 
                <condition attribute="msa_partnerid" operator="not-null" /> 
                <condition attribute="adx_partnercreated" operator="eq" value="0" /> 
                <condition attribute="adx_partnercollaboration" operator="eq" value="0" /> 
                <condition attribute="statecode" operator="eq" value="0" /> 
            </filter>
        </entity> 
    </fetch>


    Seems that for view actions in an entity list while the filter criteria can be seen might not be supported, but not clear as the information I have might be outdated from what was launched for the feature.  Give it a try out and let us know how you make out.

  • Community Member Profile Picture
    on at

    Is there any updated documention on the "Filter Criteria" capabilities? 

    I assume that this capability would allow you to show/hide a button depending on the results of the filter criteria? If so, how would you construct the filter on an entity form so that a button is only shown if a certain value is set on the record?

    Thanks

  • Suggested answer
    Nick.Doelman Profile Picture
    1,947 Most Valuable Professional on at

    This won't address the "Filter Criteria" question, but to answer on how to show/hide a button on an entity form based on a value from the record you could use the following Liquid code on a web page that contains the entity form:

    //get the context of the entity record that was launched from the entity list, "foo_entity" represents an entity name for the record

    {% assign foo_entity_object = entities.foo_entity[request.params.id]%}

    //check to see if object has a value

    {% if foo_entity_object %}

    //check a value from the entity record - just an example

    {% if foo_entity_object.foo_field.value == 1 %}

    //hide or show button, hyperlink, divs, etc

    //e.g. to hide the "submit" button

    $("#UpdateButton").hide();

    {% endif %}

    {% endif %}

    Just an idea that might help address what you are trying to do.

    Cheers

    Nick

  • Erica J Ellis Profile Picture
    71 on at

    I couldn't find documentation, but thanks to Colin's post I was able to figure out how to use the Filter Criteria field in the Advanced Settings of the Action Button Configuration for an Entity Form. By placing the below Fetch into the field I was able to successfully hide a button on a form unless the Status Reason of the Case was the value I designated.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" no-lock="true">

       <entity name="incident">

           <filter type="and">

               <condition attribute="statuscode" operator="eq" value="282230004" />

           </filter>

       </entity>

    </fetch>

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