Search This Blog

Tuesday, January 21, 2014

Dialog to write comment and select a user from Lookup to send email with comment to the user selected in Lookup

Start dialog on entity on Contact entity.
Follow these steps:

    1.Add step page
    2.Add step Prompt and response. From this prompt and response we create comment box to get comment from user. Click on set properties. I select multiline text for comment.          
                     
   4.    Now add another Prompt and response to select user. Now in this I will make a Lookup of all user        belong to this organization. Click on set properties and set those properties which are set in below       screen shot.

5. Now we send email to the user which we select from lookup and also comment is added in the subject of     this email. Add send email step now click on set properties.
  • In From: In right side select the name of user you set like in this case Sendto (user) then from its below drop down select created by no click add then click on from text box and press OK. So that {created By (Sendto (user))}.
  • In To: In right side select the name of user you set like in this case Sendto (user) then from its below drop down select User no click add then click on from text box and press OK. So that {User (Sendto (user))}.
  • Now to add comment in Detail of email: Select Comment Please from above drop down the name of comment you set in this case Comment please and then from below drop down select Response Text. So that {Response Text (Comment Please)}. 








Friday, January 3, 2014

Map fields of unrelated Entities in CRM 2011 and 2013:

In this example we map fields of salesorderdetail and quotedetail. Every organization have its own id so it’s only example.
 

·         If rss feed page open then right click and open view page source.
·         Select the entities of of which fields want to map.
·         <d:EntityMapId m:type="Edm.Guid">2fc9704e-ac2f-e311-a566-6c3be5a815e4</d:EntityMapId> This is the id
·         Go to link

·         This will open relationships of fields which have relations. Click on new to create new mapping of relations.
·         Select the same field from source and target and click ok.


*In blanks write organization name.

Thursday, January 2, 2014

To disable and enable ribbon button on change of Field Value using ribbon editor

Follow those steps:
1.      Click on the button
2.      Expand command
3.      Right click on command and select edit enable rule.
4.      Then click on the rule and press edit button.
5.      Write the field physical name in field section
6.      And also give invert (true or false) as your condition.
7.      In value section write the value on the basis of which button enable or disable.


Below Video is good :

http://www.youtube.com/watch?v=OE1CVePTeTc

Disable Lead Ribbon button using javascript in CRM 2011 and 2013

var x= top.document.getElementById("lead|NoRelationship|Form|Mscrm.Form.lead.ConvertLeadQuick-Large");
x.disabled = true;

Set Notification in Form and clear Notification

Xrm.Page.ui.setFormNotification('Please Fill the Required Fields for this Stage' ,'INFORMATION','3');// set notification

Xrm.Page.ui.clearFormNotification('3'); // clear notification


Refresh Ribbon using javascript in crm 2011 and 2013

Xrm.Page.ui.refreshRibbon();

Run dialogue by clicking Button

function project_code()//project code button
{
var dialogId = "{E8F6C5EC-E606-447E-B253-C950FB6F29B2}"; // dialogue id
var typeName = "salesorder";
var recordId = Xrm.Page.data.entity.getId();
LaunchModalDialog(dialogId,typeName,recordId);
//alert("project code");
}

function project_manager()//project manager button
{
var dialogId = "{6322F944-7202-4EDF-81A0-3EFAB678068D}"; // dialogue id
var typeName = "salesorder";
var recordId = Xrm.Page.data.entity.getId();
LaunchModalDialog(dialogId,typeName,recordId);
//alert("project manager");
}
//**This function will run buttons and dialogs working on these button**//
function LaunchModalDialog(dialogId,typeName,recordId)
{
    var serverUrl = Xrm.Page.context.getServerUrl();
    recordId=recordId.replace("{", "");
    recordId=recordId.replace("}", "");
   
    dialogId=dialogId.replace("{", "");
    dialogId=dialogId.replace("}", "");
   
   //var project_code_id = {E8F6C5EC-E606-447E-B253-C950FB6F29B2};
   //var project_manager_id = {6322F944-7202-4EDF-81A0-3EFAB678068D};

   var serverUri = serverUrl +'/cs/dialog/rundialog.aspx';
   var mypath =  serverUri +'?DialogId=%7b' +dialogId.toUpperCase()  +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';
 
   //var mypath =  serverUri +'?DialogId=%7b' +project_code_id.toUpperCase()  +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';
   // First item from selected contacts only
   window.showModalDialog(mypath);
 
   // Reload form.
   window.location.reload(true);
}