call action

GenerateGDRFAMemberId: function (id, gender, dateOfBirth, nationality, uidNO, memberType, visaFileNumber, eId, passport, birthCertificateId, memberRefId, policyNumber, uniqueMemberId, enquiryNumber, opportunityId, entityName, async, successcallback, errorcallback)

{

 

var request = “<s:Envelope xmlns:s=’http://schemas.xmlsoap.org/soap/envelope/’>&#8221; +

“<s:Body>” +

“<Execute xmlns=’http://schemas.microsoft.com/xrm/2011/Contracts/Services&#8217; xmlns:i=’http://www.w3.org/2001/XMLSchema-instance’>&#8221; +

“<request xmlns:a=’http://schemas.microsoft.com/xrm/2011/Contracts’>&#8221; +

“<a:Parameters xmlns:b=’http://schemas.datacontract.org/2004/07/System.Collections.Generic’>&#8221; +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>Operation</b:key>” +

“<b:value i:type=’a:OptionSetValue’>” +

“<a:Value>47</a:Value>” +

“</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>InputOpportunity</b:key>” +

“<b:value i:type=’a:Entity’>” +

“<a:Attributes>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_enquirynumber</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + enquiryNumber + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_opportunityid</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + opportunityId + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_emiratesid</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + eId + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_visafilenumber</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + visaFileNumber + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_memberreferenceid</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + memberRefId + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_passportnumber</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + passport + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_birthcertificateid</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + birthCertificateId + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_gender</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + gender + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_dateofbirth</b:key>” +

“<b:value i:type=’c:dateTime’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + dateOfBirth + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>membertype</b:key>” +

“<b:value i:type=’c:int’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + memberType + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_uidnouniqueidentificationnumber</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + uidNO + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_policynumber</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + policyNumber + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_memberid</b:key>” +

“<b:value i:type=’c:string’ xmlns:c=’http://www.w3.org/2001/XMLSchema’>&#8221; + uniqueMemberId + “</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“<a:KeyValuePairOfstringanyType>” +

“<b:key>oic_dhanationality</b:key>” +

“<b:value i:type=’a:EntityReference’>” +

“<a:Id>” + nationality[0].id + “</a:Id>” +

“<a:LogicalName>oic_dhacountries</a:LogicalName>” +

“<a:Name i:nil=’true’ />” +

“</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“</a:Attributes>” +

“<a:EntityState i:nil=’true’ />” +

“<a:FormattedValues />” +

“<a:Id>” + id + “</a:Id>” +

“<a:LogicalName>opportunity</a:LogicalName>” +

“<a:RelatedEntities />” +

“</b:value>” +

“</a:KeyValuePairOfstringanyType>” +

“</a:Parameters>” +

“<a:RequestId i:nil=’true’ />” +

“<a:RequestName>oic_D2CBusinessOperations</a:RequestName>” +

“</request>” +

“</Execute>” +

“</s:Body>” +

“</s:Envelope>”;

var req = new XMLHttpRequest();

// var  req = new ActiveXObject(“Msxml2.XMLHTTP”);

req.open(“POST”, OIC.ExecuteOrganizationRequests._getClientUrl(), async)

req.responseType = ‘msxml-document’;

// Responses will return XML. It isn’t possible to return JSON.

//req.responseType = ‘msxml-document’;

req.setRequestHeader(“Accept”, “application/xml, text/xml, /“);

req.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8”);

req.setRequestHeader(“SOAPAction”, “http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute“);

req.onreadystatechange = function () { OIC.D2CActions.GenerateGDRFAMemberIdResponse(req, successcallback, errorcallback); };

req.send(request);

},

 

GenerateGDRFAMemberIdResponse: function (req, successcallback, errorcallback)

{

///<summary>

/// Recieves the assign response

///</summary>

///<param name=”req” Type=”XMLHttpRequest”>

/// The XMLHttpRequest response

///</param>

///<param name=”successCallback” Type=”Function”>

/// The function to perform when an successfult response is returned.

/// For this message no data is returned so a success callback is not really necessary.

///</param>

///<param name=”errorCallback” Type=”Function”>

/// The function to perform when an error is returned.

/// This function accepts a JScript error returned by the _getError function

///</param>

if (req.readyState == 4)

{

req.onreadystatechange = null; //avoids memory leaks

if (req.status == 200)

{

if (successcallback != null)

{

var doc = req.responseXML;

var newFetchResult = XrmServiceToolkit.Soap.SelectNodes(doc, “//a:KeyValuePairOfstringanyType”);

var fetchResults = [];

if (newFetchResult != null && typeof (newFetchResult) != undefined)

{

for (var k = 0; k < newFetchResult.length; k++)

{

for (var iii = 0, nLength = newFetchResult[k].childNodes.length; iii < nLength; iii++)

{

 

if ((newFetchResult[k].childNodes[0].textContent == “OutputOpportunity” || newFetchResult[k].childNodes[0].textContent == “OutputQuote”) && fetchResults.length <= 1)

{

var entity = new XrmServiceToolkit.Soap.BusinessEntity();

entity.deserialize(newFetchResult[k].childNodes[1]);

if (entity.logicalName != undefined)

{

fetchResults.push(entity);

}

}

}

}

}

successcallback(fetchResults);

}

else

{

errorcallback(XrmServiceToolkit.Soap.GetError(req));

}

}

else

{

errorcallback(XrmServiceToolkit.Soap.GetError(req));

}

 

}

},

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s