The possible reason of this issue may be that Async Service is stopped. To solved this issue start the Async service and reset the IIS or restart the Sever.
finding crm server url from ISV.Config
write a function as
getUrl= function() {
var url=document.location.host;
return url;
}
While importing the customization from development(upgraded from 3.0 to crm 4.0) to QA Server(fresh installation CRM 4.0) i was getting this error: “Import failed: opportunity_new_dataaudit: Invalid name prefix.”
It was giving the error on particular relationship: “opportunity_new_dataaudit”
I solved this problem as open the customization.xml in edit mode its look like as
<EntityRelationship Name=”Opportunity_New_DataAudit“>
<EntityRelationshipType>OneToMany</EntityRelationshipType>
<ReferencingEntityName>New_DataAudit</ReferencingEntityName>
<ReferencedEntityName>Opportunity</ReferencedEntityName>
<CascadeAssign>NoCascade</CascadeAssign>
<CascadeDelete>RemoveLink</CascadeDelete>
<CascadeReparent>NoCascade</CascadeReparent>
<CascadeShare>NoCascade</CascadeShare>
<CascadeUnshare>NoCascade</CascadeUnshare>
<ReferencingAttributeName>new_opportunityid</ReferencingAttributeName>
<RelationshipDescription>
<Descriptions>
<Description description=”Unique identifier for Opportunity associated with Data Audit.” languagecode=”1033″ />
</Descriptions>
</RelationshipDescription>
<field name=”new_opportunityid” requiredlevel=”none” imemode=”auto” lookupstyle=”single” lookupbrowse=”0″>
<displaynames>
<displayname description=”Opportunity” languagecode=”1033″ />
</displaynames>
</field>
<EntityRelationshipRoles>
<EntityRelationshipRole>
<NavPaneDisplayOption>UseCollectionName</NavPaneDisplayOption>
<NavPaneArea>Details</NavPaneArea>
<NavPaneOrder>10000</NavPaneOrder>
</EntityRelationshipRole>
</EntityRelationshipRoles>
</EntityRelationship>
AND
<EntityMap>
<EntitySource>opportunity</EntitySource>
<EntityTarget>new_dataaudit</EntityTarget>
<AttributeMaps />
</EntityMap>
<EntityMap>
We solved this problem intrestingly, we change the name property of tag <EntityRelatioship> from opportunity_new_dataaudit
to
new_opportunity_new_dataaudit
<EntityRelationship Name=”new_Opportunity_New_DataAudit“>
<EntityRelationshipType>OneToMany</EntityRelationshipType>
<ReferencingEntityName>New_DataAudit</ReferencingEntityName>
i.e simply appending prefix new_ to the relationship name in customization.xml. It imported successfully now..
Here we will be calling the default helloworld webservice that is already created for us when we open a asp.net webservice project template in Visual Studio.
We’ll just have a textbox(html control) which will display us the Hello World! response returned from the web service.
This is the step we need to follow
1) Create a new ASP.NET WebApplication
2) Put a html textbox control on the form
<input type=”text” id=”info”/>
3) Put this script code in the head section of the aspx page
<script language=”javascript”>
var xmlHttp;
function getMessage()
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
xmlHttp.open(”post”, “http://localhost/WebService1/Service1.asmx/HelloWorld”, false);
xmlHttp.onreadystatechange=doUpdate;
xmlHttp.send();
return false;
}
function doUpdate()
{
if(xmlHttp.readyState==4)
{
var startTag = “<string xmlns=\”http://tempuri.org/\”>”;
var endTag = “</string>”;
var exch;
var valueStart = 0;
var valueEnd = 0;
valueStart = xmlHttp.responseXML.xml.indexOf(startTag, valueEnd) + startTag.length;
valueEnd = xmlHttp.responseXml.xml.indexOf(endTag, valueEnd+1);
exch = xmlHttp.responseXML.xml.substring(valueStart, valueEnd);
document.forms[0].elements[‘Info’].value=exch;
}
</script>
4) Call the getMessage function in the body’s onLoad eventHandler
<BODY onload=”getMessage()”>
5) Run the applicaton. We’ll see the HelloWorld! text in our textbox(’info’)
Now let us understand what is happening inside the javascript code
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”)
This line of code creates the XMLHttpRequest object. This object sends request to the server and processes the responses from it.
The above code creates the object specific to Internet Explorer( <=6.o).
It is implemented as Active X for IE. However in IE 7 XMLHttpRequest will come as native JavaScript object.
For other browsers we can write
xmlHttp=new XMLHttpRequest();
or best we can write this
if(window.ActiveXObject)
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
else if (window.XmlHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
xmlHttp.open(”post”, “http://localhost/WebService1/Service1.asmx/HelloWorld”, false);
The open method initializes the connection to the server and informs the xmlHttp object how to connect to the server.
post- it indicates how we want to send the data. It can be “get” as well
url- comes the url where we are connecting
false- this means we are making a synchronous call. To make asychronous call simply set it to true
xmlHttp.onreadystatechange=doUpdate;
This specifies the name of the function to be called whenever the state of the xmlHttpRequest changes
xmlHttp.send();
Send method than makes the request to server. This method would return immediately in case of asynchronous call and it would block until the synchronous response is received from the server.
if(xmlHttp.readyState==4)
It tells about the current state of the request
0- uninitialized
1- loading
2- loaded
3-interactive
4-complete
xmlHttp.responseXML.xml
It returns the current response from server in XML=
<?xml version=”1.0″?>
<string xmlns=”http://tempuri.org/”>Hello World !</string>
Than we are using some javascript functions to get the Hello World! and remove everything else.
document.forms[0].elements[‘Info’].value=exch;
Finally assigning the value to our textBox.
The function doUpdate() can be written differently so that we don’t have to make use of any string functions.
function doUpdate()
{
if(xmlHttp.readyState==4)
{
// Here the server is returning us XML in response so we can make use of responseXML
// Here the browser creates a DOM tree to represent that XML and puts a reference to that DOM tree
// in the request’s (xmlHttp) object’s responseXML
var xmlDoc=xmlHttp.responseXML;
var responseElement=xmlDoc.getElementsByTagName(”string”)[0];
var respText=responseElement.firstChild.nodeValue;
document.forms[0].elements[‘Info’].value=respText;
}
You must be logged in to post a comment.