I have generated the XRM class file using SDK in cmd prompt.
And I have installed the Package Microsoft.CrmSdk.Xrm.Tooling.CoreAssembly
for my solution then I have started using XRM file entities in my solution for query the data.
While querying the data from Dynamics CRM 365 online in Local, if I debug everything works file but if I publish and deploy it in the PROD environment I get an error
var dict = new Dictionary<string, string>();
using (var conn = getconnection())
{
e2 = "Connected: "+ conn.ConnectedOrgFriendlyName;
_orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null
? (IOrganizationService)conn.OrganizationWebProxyClient
: (IOrganizationService)conn.OrganizationServiceProxy;
e3 = "Initiatedsss";
using (var service = new XrmContext(conn))
{
crmOpp = service.OpportunitySet.Where(x => x.new_OppHubspotid == hubSpotId).ToList();
}
}
Object reference not set to an instance of an object.
StackTrace : at HubSpot_CRMIntegration.HubSpotDealService.GetDataCrmconnection(String hubSpotId) Date :10/30/2018 6:10:03 AM HubspotID: 03b0b3db-22d6-e811-a954-000d3a59746e FrameCount: 1 Error Line: 0, GetDataCrmconnection at offset 807 in file:line:column :0:0 Error 1: Entered Error 2: Connected: Anexinet Dev Testing CRM: Error 3: Initiatedssss Error 4: Error 5
StackTrace : at HubSpot_CRMIntegration.HubSpotDealService.GetDataCrmconnection(String hubSpotId) Date :10/30/2018 6:10:03 AM HubspotID: 03b0b3db-22d6-e811-a954-000d3a59746e FrameCount: 1 Error Line: 0, GetDataCrmconnection at offset 807 in file:line:column