0

Eximanie Record field is a user lookup and i want to populate this lookup value as current logged in user, but it is showing still blank on lightning component.

({
    doInit: function(component, event, helper) {
    var action = component.get("c.Merge");
    var Recordtypeid = "0123A000001O3CT";
    action.setParams({"RecordId": Recordtypeid});
    
   var userId = $A.get("$SObjectType.CurrentUser.Id");
   
   action.setCallback(this, function(response) {
        var resp = response.getReturnValue();           
        component.set("v.mergeOpt",resp);
        var record = $A.get("e.force:createRecord");
           record.setParams(
            { 
                "entityApiName": "CustomAsset__c",
                "recordTypeId" : Recordtypeid,
                "defaultFieldValues": {
                    'count__c' : 100,
                    'Eximanie_RecordId__c' : userId, 
                },
            }
        ); 
        var dismissActionPanel = $A.get("e.force:closeQuickAction"); 
        dismissActionPanel.fire();
        record.fire();
    });
    $A.enqueueAction(action);
}

})

5
  • Since you're calling an Apex class anyway, why not get the running user's ID there instead? This task would be much more straightforward in Apex: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… Dec 23 '20 at 20:55
  • You mean to say $A.get("$SObjectType.CurrentUser.Id"); is coming as blank? Dec 24 '20 at 3:03
  • do you have any field on your CustomAsset__c object with api name count? Dec 24 '20 at 9:31
  • @sanketkumar- no, i missed __c Dec 24 '20 at 16:37
  • @NagendraSingh- yes it is coming as blank Dec 24 '20 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.