locked
a message/information within lookup RRS feed

  • Question

  • Hi All,

    I use CRM 2013, and I have a requirement where I need give a message or information within lookup control.

    ex: I have a custom entity, and there have 2 lookup field (account & contact). I need do filter lookup in contact field that only have associated with account entity. but if account don't have any contact in the contact lookup should show message or info "there is no contact for this account". is it possible?

    thanks.

    Thursday, May 29, 2014 1:09 PM

Answers

  • Hi,

    Write a JavaScript function that makes a REST call (using OData) to CRM to check if there is any contact record for the account you're selecting (you can get the account id when an account is selected) and register the function against on change of the account lookup field. If no contact exists for the account, you can display an error message and blank out the field.

    However, you cannot display any error in the lookup view itself.


    Admin QuikView Solution for CRM 2013

    • Proposed as answer by Ahmad Pirani Thursday, May 29, 2014 6:19 PM
    • Marked as answer by pntr Wednesday, June 18, 2014 6:28 AM
    Thursday, May 29, 2014 3:50 PM

All replies

  • Hi,

    Write a JavaScript function that makes a REST call (using OData) to CRM to check if there is any contact record for the account you're selecting (you can get the account id when an account is selected) and register the function against on change of the account lookup field. If no contact exists for the account, you can display an error message and blank out the field.

    However, you cannot display any error in the lookup view itself.


    Admin QuikView Solution for CRM 2013

    • Proposed as answer by Ahmad Pirani Thursday, May 29, 2014 6:19 PM
    • Marked as answer by pntr Wednesday, June 18, 2014 6:28 AM
    Thursday, May 29, 2014 3:50 PM
  • To add to Dynamotion, after you retrieve data using REST and there is no contact associated with the selected account, you can also use CRM 2013 setNotification feature to show notification either at the form level or directly at the attribute level. When you have notification set at the field level, the form cannot be saved. Make sure to remove notification when your condition is satisfied.
    • Proposed as answer by Ahmad Pirani Thursday, May 29, 2014 6:19 PM
    Thursday, May 29, 2014 6:19 PM