Post

Ms Crm Plug In

Background:

There is a need to send outbound and receive the http request from CRM GUI to the third party application for a product.

did some research and found that there are few ways

Now exploring the possibilities of plug in method

asked questions on forum

https://community.dynamics.com/crm/f/117/p/142728/313312.aspx

https://www.facebook.com/groups/21809302488/10152749493047489/?notif_t=group_comment


Installing the CRM Tools for Visual Studio 2013:

Found this LINK about how to do it on vs 2013 while MS doesnt provide tools for 2013 so

but this had problem vs 2013 would even launch and give error

but after creating the registry file and adding it worked like mentioned in The LINK

Working CRM tools in VS 2013

working crm tool

After watching the tutoriali found that vs 2013 doesn’t support the CRM Explorer and connect to the crm server facility so I had to install 2012 which supports this all.

While installing the CRM Plugin Toolkit for i have encounter the problem that msi doesn’t have some .dll that why it will not execute, the solution to that is THIS LINK.

There comes a problem when I create the new CRM project which is

System.IO.FileNotFOund

Watching the tutorial about the plugin

http://www.ytpak.com/?component=video&task=view&id=rnQqxSO-WHQ

and reading the plugin Development at

http://msdn.microsoft.com/en-us/library/gg328263.aspx#bkmk_design


10/24/2014

Today registered a plugin and test it running on MS CRM

for that i have used the sample plugin provided in the sample code of the SDK The procedure is

  • Locate the plugin registration tool in  \SDK\Tools\PluginRegistration
  • run the PluginRegistration
  • Register new Assembly
  • Load the assembly from \SDK\SampleCode\CS\Plug-ins\bin\Debug\SamplePlugins.dll
  • save the changes
  • now register the steps which task you want to perform

Snapshots

plugin registration

and this is the result

plugin testing

the more detailed tutorial is provided at THIS LINK

Asked the question ON CRM Community THE LINK

How to create a new organization in MS CRM

LINK

trial time check


Getting the Phone Number in Task Activity:

Trying to get the phone number in activity using the plugin method

The discussion is going on here

https://community.dynamics.com/crm/f/117/t/143340.aspx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
if (context.InputParameters.Contains("Target") &&

  context.InputParameters["Target"] is Entity)

{

  // Obtain the target entity from the input parameters.  

  Entity entity = (Entity) context.InputParameters["Target"];

  //  

  //getting the phone number  

  string phone1 = null;

  if (entity.Attributes.Contains("Telephone1"))

  {

    phone1 = entity.GetAttributeValue("Telephone1");

  }

  // Verify that the target entity represents an account.  

  // If not, this plug-in was not registered correctly.  

  if (entity.LogicalName != "account")

    return;
  `


try  

{  

// Create a task activity to follow up with the account customer in 7 days.  

Entity followup = new Entity("task");


followup["subject"] = "The Phone Number of the Customer is:" + phone1+ "Phone No?";  

followup["description"] =  

"Follow up with the customer. Check if there are any new issues that need resolution.";  

followup["scheduledstart"] = DateTime.Now.AddDays(7);  

followup["scheduledend"] = DateTime.Now.AddDays(7);  

followup["category"] = context.PrimaryEntityName;


// Refer to the account in the task activity.  

if (context.OutputParameters.Contains("id"))  

{  

Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());  

string regardingobjectidType = "account";


followup["regardingobjectid"] =  

new EntityReference(regardingobjectidType, regardingobjectid);  

}


//  

// Obtain the organization service reference.  

IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));  

IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);  

//


// Create the task in Microsoft Dynamics CRM.  

tracingService.Trace("FollowupPlugin: Creating the task activity.");  

service.Create(followup);  

}  

//  

catch (FaultException ex)  

{  

throw new InvalidPluginExecutionException("An error occurred in the FollupupPlugin plug-in.", ex);  

}  

//


catch (Exception ex)  

{  

tracingService.Trace("FollowupPlugin: {0}", ex.ToString());  

throw;  

}  

This post is licensed under CC BY 4.0 by the author.

© 2023 by Rana Waqas. Proudly created with Jekyll and Chirpy.