Forums

Forums / Developing Portals / Read Only Lookup Field when blank

Read Only Lookup Field when blank

2 posts, 0 answered
  1. Eric Mann
    Eric Mann avatar
    9 posts
    Registered:
    16 Oct 2020
    02 Apr
    Link to this post
         I'm trying to set a lookup field to hidden when blank and ideally it would read-only or disable field. Rules Manager doesn't seem to like lookup being blank and JavaScript is returning "true" as a value for a lookup field. 
  2. Josh
    Josh avatar
    47 posts
    Registered:
    01 Jun 2018
    03 May in reply to Eric Mann
    Link to this post

    Hello Eric,

    I just investigated the issue you are experiencing, and it appears you are correct. The Rules Manager is not currently functioning correctly when you use the “DOES NOT CONTAIN VALUE” condition with the TPC Lookup widget. I will be creating an issue report, and this will be resolved in one of the next revisions of the product. I will make sure that this ticket is replied to with the revision number containing the fix.

    As a temporary workaround, you can use the TPC JavaScript API. The get_value() call on an empty lookup widget should return a value in the following format: "account;00000000-0000-0000-0000-000000000000". This is the entity logical name followed by a semi-colon and then an empty GUID. You can check to see if the value of the lookup contains an empty GUID, in which case you can execute your logic. Regarding the timing of this code, you can listen for the tpc:ready event (which will be fired as soon as all the TPC controls on the page have loaded their data). More information on the TPC JavaScript API can be found at https://www.crmportalconnector.com/developer-network/documentation/portal-connector-widgets/tpc-client-side-api/mvc-based.

    Please let me know if there is anything else you need!

    Cheers,
    Josh

2 posts, 0 answered