Forums

Forums / Developing Portals / Show/hide fields based on a lookup value using Rules Manager

Show/hide fields based on a lookup value using Rules Manager

8 posts, 0 answered
  1. Dan Rausch
    Dan Rausch avatar
    11 posts
    Registered:
    20 Aug 2021
    28 Jul 2022
    Link to this post
    We are trying to show/hide a textbox based on a specific selection in a lookup widget (e.g. select Other in the lookup and the textbox is shown to capture the "other" value).  We have a rules manager that is trying to show/hide the textbox based on a value in the lookup.  For example:

    When (lookup widget) Equals (guid value)
    Then Show (textbox)

    It's not working and we think the problem we are running into is that the guid we are specifying is from our CRM and is not encrypted.  It doesn't look like the Rules Manager is able to encrypt that value and compare it to the selected value in the lookup.

    We don't want to turn off encryption on our lookup widget.  Is there anything else that we can do to get this working?

    Thanks.
  2. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    02 Aug 2022 in reply to Dan Rausch
    Link to this post
    Dan,
    You are correct that the Rules Manager needs the encrypted GUID and then it would work. I've tested this approach in one of our sites. You can get the encrypted GUID via the get_value or get_fetchValue method on the lookup field. You would then just add the actual GUID to the Rule. 
    Hope this helps. 

    Eric 
  3. Dan Rausch
    Dan Rausch avatar
    11 posts
    Registered:
    20 Aug 2021
    02 Aug 2022 in reply to Eric Mann
    Link to this post
    Thanks Eric, a couple of follow-up questions:
    - if we determine the encrypted guid (using the get_value as you suggest), is that going to be consistent every time (i.e. does the encryption algorithm always return the same value for a CRM guid)?
    - we are ensuring that we keep the same guids from the Dev CRM to the QA CRM but if we deploy our portal from a Dev to a QA site, is the encrypted value going to be the same between Dev and QA? I wouldn't want our form to break just because we moved it to another environment.

    Thanks
    Dan
  4. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    02 Aug 2022 in reply to Dan Rausch
    Link to this post
    Dan,
    In my experience the GUIDs will change from Site to Site, this may be due to using different App Users for the TPC to Dynamics integration. I'm not aware of a setting to match encryption key thus render the same GUID.

    Eric 
  5. Bhargavi Mahal
    Bhargavi Mahal avatar
    14 posts
    Registered:
    16 Dec 2020
    02 Aug 2022
    Link to this post
    Hello Dan,

    Thank you for posting your query.

    As Eric posted, tpc.forms[0].fieldName.get_fetchValue(); should get the GUID value of the lookup value and you can use that GUID in Rules Manager.

    Having said that, if you are maintaining same GUID for both Dev CRM and QA CRM, I think in my experience, your form should be able to work fine. Also, please make sure that you use migration tool to migrate the pages and forms from DEV to QA.

    Kindly, test it and let us know how it goes.

    Thank you,

    Regards,
    Bhargavi Mahal.
  6. Uygar Gunay
    Uygar Gunay avatar
    8 posts
    Registered:
    11 Feb 2022
    03 Aug 2022
    Link to this post
    Hi Bhargavi,

    Our issue is the rules manager is not triggered with the value of the lookup field. 
    The value in here will get the encrypted guid. How can we use encrypted values to trigger the rules manager without coding.

    For Example: 
    Field - Event - Value 
    lookupfield - is equal to - 5082349-23423423-234-2342342

    Here, the guid we will see from the database will be different than the encrypted. We can't use text instead of the guid either. 

    We want to be able to trigger the events with the value of the lookup. for example if the lookup is "schools" we want to show "schools lookup". If the lookup text is "classes" we want to show the "classes lookup" 



  7. Uygar Gunay
    Uygar Gunay avatar
    8 posts
    Registered:
    11 Feb 2022
    03 Aug 2022 in reply to Eric Mann
    Link to this post
    Hi Eric, 
    Encryption is different per person. What I see for an encrypted value for a lookup field value will be different from another users encrypted value. The rules manager will work if I trigger the rules manager with the encrypted id but it will not trigger if another user logins and triggers the same rule manager. We had that issue before and the solution was creating a saved query, sending the encrypted guid as an encrypted parameter to the query and get the actual id from database to use. Please let me know if the encryption per user system has changed. 
    Thanks,
    Uygar
  8. Eric Mann
    Eric Mann avatar
    59 posts
    Registered:
    16 Oct 2020
    03 Aug 2022 in reply to Uygar Gunay
    Link to this post
    Uygar,
    I haven't experience where the encrypted value changes based on logged in portal user. Again I'm not familiar with encryption settings in TPC as I haven't found those in the tool yet / if they are exposed. 

    Thank you,

    Eric 
8 posts, 0 answered