Hello everyone,
My organization has upgraded from CRM 2011 to CRM 2016 SP1. In we had added a custom "Lookup Address" button to a couple of the forms that did not support that functionality OOTB. Naturally, after the upgrade, this code stopped funstioning and
I have been attempting to update it. Initially, after the upgrade, the button did not do anything. However, after making some changes, the button "works" but produces the following error.
<?xml version="1.0"?>
-<error xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<exception>Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #C1D5F608Detail: <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"> <ErrorCode>-2147220970</ErrorCode> <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /> <Message>System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #C1D5F608</Message> <Timestamp>2016-11-29T19:51:26.801987Z</Timestamp> <InnerFault i:nil="true" /> <TraceText i:nil="true" /> </OrganizationServiceFault> </exception>
<parameters xsi:nil="true"/>
<displaytitle/>
<displaytextencoded/>
<displaytext/>
<description>CRM Parameter Filter - Invalid parameter 'headerForm=1' in Request.QueryString on page /CRMTest/Handlers/WebResource.ashx The raw request was 'GET /CRMTest/{636160451970000359}/WebResources/CRMTest/sfa/quotes/dlg_lookupaddress.aspx?Data=LookupAddress&headerForm=1&parentId=%7bDB4A56CB-6809-E511-91A1-0050569C003F%7d&parentType=1&willCall=0' called from .</description>
<file>Not available</file>
<line>Not available</line>
<details>Not available</details>
<traceInfo/>
<requesturl>http://azcrmdev/CRMTest/Handlers/WebResource.ashx?name=CRMTest/sfa/quotes/dlg_lookupaddress.aspx&Data=LookupAddress&headerForm=1&parentId=%7bDB4A56CB-6809-E511-91A1-0050569C003F%7d&parentType=1&willCall=0</requesturl>
<pathAndQuery>/CRMTest/Handlers/WebResource.ashx?name=CRMTest/sfa/quotes/dlg_lookupaddress.aspx&Data=LookupAddress&headerForm=1&parentId=%7bDB4A56CB-6809-E511-91A1-0050569C003F%7d&parentType=1&willCall=0</pathAndQuery>
<source>ASHX_XML</source>
<stacktrace/>
</error>
I have tried using the "extraqs" parameter, "encodeURIComponant", and have even added the parameters by name to the form itself. These were all possible solutions
that I found during my research. Most of these solutions seemed to be directed at 2011, however. I have also read that this simply may not work at all since the upgrade to SP1.
Any insight would be greatly appreciated.
Here is the code I have so far (The offending line of code is in bold).
function CustomLookup() {
//debugger
//var aoItems = getFieldValue("customerid");
var aoItems = Xrm.Page.getAttribute("customerid").getValue();
if (aoItems == null) {
alert("Account is not Selected");
return;
}
var object = Xrm.Utility.openWebResource(Xrm.Page.context.prependOrgName("/sfa/quotes/dlg_lookupaddress.aspx?headerForm=1&parentType=1&parentId=" + aoItems[0].id + "&willCall=0"), "LookupAddress", 500, 330, true);
//debugger
if (object) {
if (object.BillTo && object.ShipTo) {
retrieveRecordXrm(object.Address.AddressId, "CustomerAddressSet", populateBillShipAddress, retrievalFailed, true);
}
else if (object.BillTo) {
retrieveRecordXrm(object.Address.AddressId, "CustomerAddressSet", populateBillAddress, retrievalFailed, true);
}
else if (object.ShipTo) {
retrieveRecordXrm(object.Address.AddressId, "CustomerAddressSet", populateShipAddress, retrievalFailed, true);
}
}
}
function populateBillShipAddress(object) {
populateBillAddress(object);
populateShipAddress(object);
}
function populateBillAddress(object) {
populateBillAddress(object);
}
function populateShipAddress(object) {
populateShipAddress(object);
}