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

Dynamic behavior of Lookup field in CRM 2015

$
0
0

Dear Experts,

We are getting a very unexpected behavior for one of the lookup field in CRM 2015.

We have Customize entity as 'Policy' and 'Cliam' in our env. To reach 'claim' page we need to navigate Client>>Policy>>Claim.

We also have created Quick Form for Claim entity. To save this Quick Claim 'Client Name' and 'Policy Name' fields are mandatory.

On selection of Client in ClientName Lookup, PolicyName lookup is autopopulated.

Now the issue is, On selection of client name in ClientName Lookup, PolicyName lookup will get autopopulated properly, but when we selects any policy from the PolicyName lookup, policy field gets collapsed and when me move cursor over to PolicyName Lookup field, it will show the selected policy.

PolicyName Lookup will only visible till we have cursor over the field.


We are using following code to auto populate policyname Lookup.

function FilterPoliciesLookup() {

//debugger

try {

if (Xrm.Page.data.entity.attributes.get("new_client_name") != null) {

var ClientName = Xrm.Page.getAttribute("new_client_name").getValue();

if (ClientName != null) {

var Clientid = ClientName[0].id;

var Clientname = ClientName[0].name;

var viewId = "{00000000-0000-0000-0000-000000000001}";

var entityName = "new_policy";

var viewDisplayName = "Policies List for " + Clientname + "";

var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"

+ "<entity name='new_policy'>"

+ "<attribute name='new_name' />"

+ "<attribute name='new_vantagepolicynumber' />"

+ "<attribute name='createdon' />"

+ "<filter type='and'>"

+ "<condition attribute='new_clientname' operator='eq' value='" + Clientid + "' />"

+ "</filter>"

+ "</entity>"

+ "</fetch>";

var layoutXml = "<grid name='resultset' " +

"object='1' " +

"jump='new_policyId' " +

"select='1' " +

"icon='1' " +

"preview='1'>" +

"<row name='result' " +

"id='new_policyId'>" +

"<cell name='new_name' " +

"width='150' />" +

"<cell name='new_vantagepolicynumber' " +

"width='100'/>" +

"<cell name='createdon' " +

"width='100'/>" +

"</row>" +

"</grid>";

Xrm.Page.getControl("new_policyid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

}

}

} //try end

catch (Ex)

{ }

}

Please suggest if i am missing anything in the code or is this any configuration issue.

Thanks in advance.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



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