Help! Please!
I am attempting to display a variable on the screen for troubleshooting purposes as I need to see what is being returned by the system. Therefore, I have placed the following script in the create script box for the field comp_name of the companylongbox. However the system is returning a "Safe Call exception". When I open a company record.
var compID = CRM.GetContextInfo("company","comp_companyid");
var compRecord = CRM.FindRecord("company","comp_companyid="+compID);
var CustomerID = compRecord.comp_customerid;
var mySQL = "Select * FROM [MY-CRM\SQLEXPRESS32].[CREdata].[dbo].[vCREcustomer] WHERE CUST = '"+CustomerID+"'"
var myCREdata = CRM.CreateQueryObj(mySQL,"");
myCREdata.SelectSql();
var daysTillDue = myCREdata.CDAYDUE;
ErrorStr += "daysTillDue = "+daysTillDue+".";
I have highlighted the field above to show where the issue appears to be. Based on the log output below, the highlighted server reference is being changed from
MY-CRM\SQLEXPRESS32
to
MY-CRMSQLEXPRESS32
I am getting the following error returned...
Select * FROM [MY-CRMSQLEXPRESS32].[CREdata].[dbo].[vCREcustomer] WHERE CUST = 'zzTestComp'
Could not find server 'MY-CRMSQLEXPRESS32' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers
How can I prevent the \ from being dropped from my server name.
Any assistance would be greatly appreciated.