function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karen Guaspari 8Karen Guaspari 8 

Unable to clear Force:inputfield lookup field

I have a form where I am getting information to insert, once inserted I want to reset the form.  All fields will reset except lookup fields.  I tried several methods for resetting the Account lookup but whatever account name is displayed will not clear.  I am able to clear all other types of fields.  Can someone please let me know what needs to be done to clear a lookip field?

Here is the code:

<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" access="GLOBAL">
    <aura:attribute name="newItem" type="AQB__Batch_Item__c" access="GLOBAL" default="{ sobjectType: 'AQB__Batch_Item__c', 'AQB__Account__c': '', 'AQB__Account__r': '', 'AQB__Method__c': '' }" />   
    <force:inputField aura:id="AccountLookup" value="{!v.newItem.AQB__Account__c}" />
    <force:inputField value="{!v.newItem.AQB__Method__c}" />
    <ui:button label="Reset" press="{!c.resetForm}" />   
</aura:component>

Controller:
({
    resetForm : function(component, event, helper) {
        component.set("v.newItem.AQB__Account__c", '');               
        component.set("v.newItem.AQB__Account__r", '');               
        component.set("v.newItem.AQB__Method__c", '');               
        component.set("v.newItem", {'sobjectType':'AQB__Batch_Item__c',
                'AQB__Account__c': '',
                'AQB__Account__r': '',
                'AQB__Method__c': ''});
        var item = component.get("v.newItem");
        item.AQB__Account__c = '';
        item.AQB__Account__r = '';
        component.set("v.newItem", item);               
    }
})


 
krisstannumkrisstannum
I have the same issue and still looking for solution. However, the temporary solution i did is to refresh the page using: 
$A.get('e.force:refreshView').fire();