Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Unable to get property 'trim' of undefined or null reference

$
0
0

Hi,

I have problem when I try to setValue lookup field, it's throw Unable to get property 'trim' of undefined or null reference. the value that I enter is not null( I checked).

it's happen only in contact (account is ok).

I don't know what is the problem :/

my code:

function getAccountLookup()

{

try {

var xrmObject = Xrm.Page.context.getQueryStringParameters();

if (xrmObject != null&& xrmObject["account_id"]) {

//account

var id = xrmObject["account_id"].toString();

var name = xrmObject["account_name"].toString();

var entityType = xrmObject["account_type"].toString();

SetLookupValue("customerid", name, id, entityType);

//contact

if (xrmObject["contact_id"] && xrmObject["contact_id"] != null) {

var id = xrmObject["contact_id"].toString();

var name = xrmObject["contact_name"].toString();

var entityType = xrmObject["contact_type"].toString();

SetLookupValue("fl_contactid", name, id, entityType);

}

}

catch (e)

{ }

}

function SetLookupValue(lookup, name, id, entityType)

{

if (Xrm.Page.getAttribute(lookup) != null) {

var lookupValue = new Array();

lookupValue[0] = new Object();

lookupValue[0].id = id;

lookupValue[0].name = name;

lookupValue[0].entityType = entityType;

Xrm.Page.getAttribute(lookup).setValue(lookupValue);

}

}

hope you can help me :)


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>