locked
CRM 2016: How to Clear/Set Null value to a lookup which was autopopulated by an system default mapping RRS feed

  • Question

  • CRM 2016: How to Clear/Set Null value to a lookup which was auto populated by an system default mapping.

    We have 2 custom(Account) lookup fields created on opportunity form. One of the lookup is Encrypted(enabled Field Level Security) which doesn't have access to all users in the system. When end users are created an opportunity from Account Entity(Sub-Grid) these custom fields are auto populated by the system default mapping, some of the users do not have access to the Encrypted field by default hence it is giving below error and not allowing to create an opportunity from Account entity only.

    I am thinking issue will be resolved if we can clear or set NULL value to the Encrypted field in the system. I have tried clearing the value using JavaScript seems it is not working to the users who doesn't have permission to the Encrypted Field. Is there any way that we can impersonate and clear the value in JavaScript? Is there any approach that we can resolve the issue.

    Any suggestions/comments on this would be great!

    Thanks, 


    Madhu M.


    • Edited by Madhu_M Thursday, November 3, 2016 1:49 AM
    Thursday, November 3, 2016 1:46 AM

Answers

  • instead of setting NULL value, removing the field from the context will be a good idea. so it will have blank value after creating the record.

    below is the sample code that I have used to remove field from the Plugin execution context

    ((Entity)(context.InputParameters["Target"])).Attributes.Remove("xxxxxxxxxx");


    Madhu M.


    • Edited by Madhu_M Monday, November 7, 2016 10:44 PM
    • Marked as answer by Madhu_M Monday, November 7, 2016 10:44 PM
    Monday, November 7, 2016 10:44 PM

All replies

  • You can't impersonate another user in JavaScript. You could try using a plugin on a pre-event to clear this value. Otherwise, can't you just remove this field from the mapping ?

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Thursday, November 3, 2016 12:24 PM
    Moderator
  • System Mapping cannot be removed. I am trying to find how to clear the value in the plugin execution context.

    Do you have any snippet how to clear the values in Pre-validation of create event?


    Madhu M.

    Thursday, November 3, 2016 3:44 PM
  • instead of setting NULL value, removing the field from the context will be a good idea. so it will have blank value after creating the record.

    below is the sample code that I have used to remove field from the Plugin execution context

    ((Entity)(context.InputParameters["Target"])).Attributes.Remove("xxxxxxxxxx");


    Madhu M.


    • Edited by Madhu_M Monday, November 7, 2016 10:44 PM
    • Marked as answer by Madhu_M Monday, November 7, 2016 10:44 PM
    Monday, November 7, 2016 10:44 PM