Search

RIDE TO MS-CRM

!!!…….Where there is a will there is a way…..!!!

Tips and Tricks for Portals

  1. To open cache page, add following contents to  your portal URL
  2. To open the registration page, add following contents to  your portal URL
  3. To Send Email for invitation code redemption, enable  following workflow
    • Send Invitation Workflow ( In Employee Self Service Portal Only)
    • Modify below properties of workflow
      • Starts When: Record is created
      • Create an email to act as an email template step body: replace URL with your portal URL as shown below
        • {Encoded Invitation Code(Encode Invitation Code)}”>http://localhost:7500/register/?returnurl=%2f&invitation={Encoded Invitation Code(Encode Invitation Code)}                                To                                                                                                        {Encoded Invitation Code(Encode Invitation Code)}”>https://portalname.microsoftcrmportals.com/register/?returnurl=%2f&invitation={Encoded Invitation Code(Encode Invitation Code)}
Advertisements

How To Retrieve Data Synchronously Using ODATA.

// JavaScript source code

/*
We can genenerate the OData Query using ODataQueryDesigner Tool.
*/

function getRelatedCasesForLogId(logId) {
try {
var dataResult = null;
var clientUrl = Xrm.Page.context.getClientUrl(); // Current Organization Url.
var path = “/XRMServices/2011/OrganizationData.svc”; //ODATA Service Declaration
var oDataPath = clientUrl + path; //Entire URL of organization
if (logId != null) {
filter = “/IncidentSet?$select=IncidentId,new_RelatedLogId_att&$filter=new_RelatedLogId_att/Id eq (guid'” + logId + “‘)”; //Required OData Query
}
var oDataPathUrl = oDataPath + filter;
dataResult = retriveOdataResults(oDataPathUrl); //function to call the result set
if (dataResult != null) {
if (dataResult.results != null && dataResult.results.length > 0) {
return true;
} else {
return false;
}
}
} catch (e) { }
}
//
function retriveOdataResults(oDataPathUrl) {
var records = null;
try {
var retrieveRecordsReq = new XMLHttpRequest();
retrieveRecordsReq.open(‘GET’, oDataPathUrl, false);
retrieveRecordsReq.setRequestHeader(“Accept”, “application/json”);
retrieveRecordsReq.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
retrieveRecordsReq.send(null);
records = this.JSON.parse(retrieveRecordsReq.responseText).d;
} catch (e) { }
return records;
}

*Note : Copy this code in one of the JS file ,so that you can view the proper alignment of the code.

MS CRM + JAVASCRIPT + How to Create and Retrieve Contacts using SOAP query.

/// <reference path=”../helper/json2.js” />
/// <reference path=”../helper/jquery.js” />
/// <reference path=”../helper/XrmServiceToolkit.js” />
/// <reference path=”../helper/XrmPageTemplate.js” />

var testMethod = function () {
try {
var currentRecordId = null;

if (Xrm.Page.data) {
currentRecordId = Xrm.Page.data.entity.getId();
}
else if (window.opener.Xrm.Page.data) {
currentRecordId = window.opener.Xrm.Page.data.entity.getId();
}
else {
alert(“Something is wrong to get recordid. Please contact administrtor for the issue.”);
}

var createContact = new XrmServiceToolkit.Soap.BusinessEntity(“contact”);
createContact.attributes[“firstname”] = “Jaimie”; //string
createContact.attributes[“lastname”] = “Ji”; //string
createContact.attributes[“gendercode”] = { value: 1, type: “OptionSetValue” }; //Optionset // Picklist
createContact.attributes[“familystatuscode”] = { value: 1, type: “OptionSetValue” }; // Picklist :Single – 1
createContact.attributes[“creditlimit”] = { value: 2, type: “Money” }; //Money
createContact.attributes[“birthdate”] = new Date(); //Date
createContact.attributes[“donotemail”] = true; // bool // TwoOptionSet
createContact.attributes[“donotphone”] = false; // bool // TwoOptionSet
createContact.attributes[“parentcustomerid”] = { id: currentRecordId, logicalName: “account”, type: “EntityReference” }; //lookup

var contactId = XrmServiceToolkit.Soap.Create(createContact);

var cols = [“firstname”, “lastname””familystatuscode”, “ownerid”, “creditlimit”, “birthdate”, “donotemail”, “donotphone”];
var retrievedContact = XrmServiceToolkit.Soap.Retrieve(“contact”, contactId, cols);
if (retrievedContact != null) {
alert(retrievedContact.attributes[‘firstname’].value);
}
}
catch (err) {
alert(err.message);
}
};

testMethod();

*Note : Copy this code in one of the JS file ,so that you can view the proper alignment of the code.

Welcome all in the world of MS CRM.

Ahhhhhhhhhhhhhhh!!!!…Finally created a blog to post my comments and knowledge related to my favorite technology .NET and MS CRM.

This is small try from me to post the solutions of problems which I faced while developing the things in MS CRM. Sometimes ,there are some issues which we can not resolved even after hard searching on google and we have to apply our own brain for that.

Will keep posting this kind of things and you can easily search my blog and can resolve the issue if it is related with same concern.

Keep reading the blog…:)

Your questions are always welcome…!

Create a free website or blog at WordPress.com.

Up ↑