web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How do you fix the error message (No Name)

(0) ShareShare
ReportReport
Posted on by 1,532

**** Every time I think I have made it something else throws me a curve. ****

Could someone please help me with this issue.

I have reviewed this link https://us.hitachi-solutions.com/blog/no-name-mapping-mystery-solved/ and I do not understand it.

I have an object that I'm creating in javascript to create a entity record. If the Technician2Id is blank or null set the attribute.  Very simple.

var caseDSObject = {};

if (caseArray[0].new_Technician2Id.Id != null && caseArray[0].new_Technician2Id.Id != "") {
   caseDSObject.new_Technician2Id = { "Id": caseArray[0].new_Technician2Id.Id, "LogicalName": "systemuser", "Name": caseArray[0].new_Technician2Id.Name };
} else {
   caseDSObject.new_Technician2Id = null;
}

My problem is that when I leave it blank.  I am getting this error message that I can't seem to fix.

NoName.PNG

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: How do you fix the error message (No Name)

    Hi,

    If this error happened when JS is loading, something wrong with your JS.

    Refer below article on how to set a lookup field. 

    https://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2017/09/20/how-to-get-and-set-a-lookup-field-using-javascript-in-dynamics-365

    Refer below article on how to clear a lookup field.

    http://crmdm.blogspot.com/2011/06/as-you-all-know-one-of-best-features-of.html

  • rthompson Profile Picture
    1,532 on at
    RE: How do you fix the error message (No Name)

    Thanks for the response.  I know how to create lookup fields using javascript.  I have never seen this (No Name) before.

    var caseDSobject = "";
    caseDSObject.new_name = results[0].new_name;
    caseDSObject.new_CaseId = { "Id": caseId, "LogicalName": "incident", "Name": iCaseTitle };
    
    
    caseDSObject.new_DataSheetTemplateId = { "Id": results[0].new_datasheettemplateId, "LogicalName": "new_datasheettemplate", "Name": results[0].new_name };
    
    caseDSObject.new_EngineerId = { "Id": caseArray[0].new_EngineerId.Id, "LogicalName": "systemuser", "Name": caseArray[0].new_EngineerId.Name };
    
    caseDSObject.new_Technician1Id = { "Id": caseArray[0].new_Technician1Id.Id, "LogicalName": "systemuser", "Name": caseArray[0].new_Technician1Id.Name };
    
    if (caseArray.length > 0) {
       if (caseArray[0].new_Technician2Id.Id != null && caseArray[0].new_Technician2Id.Id != "") {
          caseDSObject.new_Technician2Id = { "Id": caseArray[0].new_Technician2Id.Id, "LogicalName": "systemuser", "Name": caseArray[0].new_Technician2Id.Name };
       } else {
          caseDSObject.new_Technician2Id = null;
       }
                                   
    }
    
    SDK.REST.createRecord(caseDSObject, "new_casedatasheettemplate", caseDataSheetTemplateCallBack, caseDataSheetTemplateError);


    When setting the new_Technician2Id to null is causing the below error message.

    The above code in red is causing this error message. 

    2146.NoName.PNG

  • Suggested answer
    rthompson Profile Picture
    1,532 on at
    RE: How do you fix the error message (No Name)

    Thanks Wei,

    You were right.  I has some other code in my javascript that was not define correctly.  The statement should have been  

    if (Xrm.Page.getAttribute("new_technician2id").getValue() == null) {
      lookup = results.new_Technician2Id;
        if (lookup != null) {
          lookup = results.new_Technician2Id;
          fieldName = "new_technician2id";
          fieldId = lookup.Id;
          valueName = lookup.Name;
          entityType = lookup.LogicalName;
          SetLookupValue(fieldName, fieldId, valueName, entityType);
       }
    }


    The correct statement should have been  Xrm.Page.getAttribute("new_technician2id").getValue() != null)

  • Suggested answer
    Clint Woods Profile Picture
    1,031 on at
    RE: How do you fix the error message (No Name)

    Not sure if you resolved this @rthompson, but this little function always works for me. If you use this and still have issues, verify that the value passed in as 'name' is not null or an empty string.

    function SetLookupValue(formContext, attributeName, id, name, entityType) {

    if (attributeName !== null) {

    try {

    var oAttribute = formContext.data.entity.attributes.get(attributeName);

    if (oAttribute != null) {

    var lookupValue = new Array();

    lookupValue[0] = new Object();

    lookupValue[0].id = id;

    lookupValue[0].name = name;

    lookupValue[0].entityType = entityType;

    oAttribute.setValue(lookupValue);

    }

    }

    catch (err) { //do nothing }

    }

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans