Posts

Showing posts from 2017

SEND EMAIL through Web API request in MS CRM 2016

‘email‘ is a bound entity to use SendEmail Action. ‘IssueSend‘ is the Boolean parameter to be passed to the action. If ‘IssueSend’ = true, then the email will mark the email to be sent. Activity Status = Pending Send If ‘IssueSend’ = false, then the email will be marked as sent. Activity Status = Sent var parameters =    {        "IssueSend": false    }; var request = new XMLHttpRequest(); request.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/emails(5F3753B9-0856-E611-80EA-005056981E85)/Microsoft.Dynamics.CRM.SendEmail", true); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Content-Type", "application/json; charset=utf-8"); request.setRequestHeader("OData-MaxVersion", "4.0"); request.setRequestHeader("OData-Version", "4.0"); request.onreadystatechange = function () {     if (this.readyState === 4) {  ...

Execute custom/system ACTION using Web API in MS CRM 2016

//Custom Action with parameters to add a notes to account record. Action unique name: new_customaction. Input Parameter:  Name=’Title’ var notesData = {     "Title": "Sample Notes." }; var query = "accounts(34C77C3E-E6F7-E511-80E5-005056981E85)/Microsoft.Dynamics.CRM.new_customaction"; var request = new XMLHttpRequest(); request.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/" + query, true); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Content-Type", "application/json; charset=utf-8"); request.setRequestHeader("OData-MaxVersion", "4.0"); request.setRequestHeader("OData-Version", "4.0"); request.onreadystatechange = function () {     if (this.readyState == 4) {         request.onreadystatechange = null;         if (this.status == 200) {             // Successful         }     } };

retriveing the current CRM version using web api request in mscrm

///the complete code for using RetrieveVersion function, which can be used to get current CRM version: function GetCRMVersion() {     //get CRM URL     var serverURL = Xrm.Page.context.getClientUrl();     //write request for function      var req = new XMLHttpRequest();     req.open("GET", serverURL + "/api/data/v8.0/RetrieveVersion()", true);     req.setRequestHeader("Accept", "application/json");     req.setRequestHeader("Content-Type", "application/json; charset=utf-8");     req.setRequestHeader("OData-MaxVersion", "4.0");     req.setRequestHeader("OData-Version", "4.0");     req.onreadystatechange = function() {         if (this.readyState == 4 /* complete */ ) {             req.onreadystatechange = null;             if (this.status == 200)//check response is OK {     ...

how to create report rdl file in mscrm

Image
1. Install Bids Tool in Visual Studio 2. Open new project in VS 3. Templates -> Business Intelligence ->Report Service ->Report Server Project 4. Go to View ->Report Data 5. Click on Data Source -> Add Data Source 6. In Data Source Properties ->Connection String-> Enter Url “/” Oraganization Name and Enter 7. Credentials -> check Use this user name and Password of crm and click Enter 8. Select the Data Sets -> Data Set Properties -> Data Source ->DataSource1 ->Query type(Text) Query(Enter Fetch Xml Code) 9. Enter Values dynamically using Parameters see the below screen shots. Fetchxml code: < fetch version = " 1.0 " output-format = " xml-platform " mapping = " logical " distinct = " false " >   < entity name = " account " >     < attribute name = " name " />     < attribute name = " primarycontactid " />     ...

Calling Action using javascript with web api request in mscrm

Image
// how to Call action Using javascript function hanleWebLead() {     var actionName = new_actioncallusingjs;         //defien action input parameters     var aactionParameters = {         "topic" : $( "#topic" ).val(),         "firstName" : $( "#firstName" ).val(),         "lastName" : $( "#lastName" ).val()     };     var actionResponse = activieCustomAction(actionName, aactionParameters);     alert(actionResponse.newLeadUrl); } function activateCustomAction() {     var Id = Xrm.Page.data.entity.getId().replace( '{' , '' ).replace( '}' , '' );     var serverURL = Xrm.Page.context.getClientUrl();     // pass the id as inpurt parameter     var data = {   ...

Calling a workflow using web api request in mscrm

function executeWorkflow(accountId, workflowId, clientUrl) {     var functionName = "executeWorkflow >>";     var query = "";     workflowId = "1f5bee55-222e-4741-9318-b3236c88ba02";     try {         //Define the query to execute the action         query = "workflows(" + workflowId.replace("}", "").replace("{", "") + ")/Microsoft.Dynamics.CRM.ExecuteWorkflow";         var data = {             "EntityId": accountId//current entity         };         //Create request         // request url         //https://org.crm.dynamics.com/api/data/v8.2/workflows(“f0ca33cc-23fd-496f-80e1-693873a951ca”)/Microsoft.Dynamics.CRM.ExecuteWorkflow         var req = new XMLHttpRequest();         req.open("POST", clientUrl + "/api/data/v8....

create Email and create attachement and send email on demand of workflow using js in smcrm

///creating the email function emailSend() {     debugger;     var caseResult = caseRecordData();     var activityPartyFrom = new Object();     var userId = Xrm.Page.context.getUserId().replace("{", "").replace("}", "")     var emailPartyEntities = [{         PartyId: { LogicalName: CustomerId.LogicalName, Id: custId },         ParticipationTypeMask: { Value: 2 }     }, {         PartyId: { LogicalName: "systemuser", Id: userId },// Xrm.Page.context.getUserName() { LogicalName: Xrm.Page.context.getUserName(), Id: userId },         ParticipationTypeMask: { Value: 1 }     }];     var email = {         Subject: Title,//"purushotham",//emailSubject, /* "MTC Microsoft CRM Proposal/Invoice - ApprovalRequested",*/         MimeType: "text/html",         Descript...

how to hide the Option Set field values using java script in MS CRM

//based on am_salesTeam Field in am_leadsourceglobal field option values will be displayed function hideOptionsetValues() {     if (Xrm.Page.getAttribute("am_salesteam") != null && Xrm.Page.getAttribute("am_leadsourceglobal") != null) {         if (Xrm.Page.getAttribute("am_salesteam").getValue() != null) {             var Salesteam = Xrm.Page.getAttribute("am_salesteam").getValue();             var LeadsourcedetailglobalValue = null;             if (Xrm.Page.getAttribute("am_leadsourceglobal") != null && Xrm.Page.getAttribute("am_leadsourceglobal").getValue() != null) {                 LeadsourcedetailglobalValue = Xrm.Page.getAttribute("am_leadsourceglobal").getValue();             }             var LeadsourceglobalOptionSet = Xrm.Page.ui.cont...

call plugin on Ribbon button click in mscrm

call plugin on Ribbon button click in mscrm ///////////// one way a button click is a client event, so at least a few javascript lines are required. the easiest way in my opinion is to create a dummy entity and attach the plugin to the create event of records of this dummy entity. the custom javascript will just create a record of this dummy entity using an odata call ///////////////another way Create a dummy field and hide it in form. update the field value once button is clicked. and you can call the plugin once the dummy fields value gets updated. //Load the .js file on ribbon click with fucntion name "ribbonButtonClick" /////javascript code function ribbonButtonClick() {     debugger;     var recBillID = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");     var count = Xrm.Page.getAttribute("apy_updatecount").getValue();     if (count == null || count == undefined) {         count = 1;  ...

how to set the Lookup and PartyList Lookup in mscrm

Image
In the example below, the Sender on the phone call is a Lookup field. To populate a Lookup field with JavaScript, you would use the code below:    lookUpObject.id = <guid>;    lookUpObject.name = "Joe CRM";    lookUpObject.entityType = 2;                   Xrm.Page.getAttribute("<LookUpFieldName>").setValue(lookUpObject); You’ll also see in the example below that the Recipient on the phone call is a PartyList field. This is the JavaScript you would use to populate a PartyList field:    var partlistData = new Array();    partlistData[0] = new Object();    partlistData[0].id = <guid>;    partlistData[0].name = "Joe CRM";    partlistData[0].entityType = 2;    Xrm.Page.getAttribute("to").setValue(partlistData);

work flow to update the status of the record in mscrm

using AuthorizeNet; using AuthorizeNet.Api.Contracts.V1; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Workflow; using net.authorize.ARB; using System; using System.Activities; using System.IO; using System.Security.Cryptography; using System.Text; using AuthorizeNet.Api.Controllers; using AuthorizeNet.Api.Contracts.V1; using AuthorizeNet.Api.Controllers.Bases; namespace CreditCardTransaction {     public class SubscriptionStatus : CodeActivity     {         //[Output("Status")]         //public OutArgument<int> Status { get; set; }         protected override void Execute(CodeActivityContext executionContext)         {             ARBGetSubscriptionStatusResponse subscriptionResponse;             CustomerGateway customerGateway; ...