Produced by Araxis Merge on 2/1/2017 2:56:50 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\Plug-ins | FollowupPlugin.cs | Tue Dec 20 19:51:43 2016 UTC |
| 2 | Wed Feb 1 19:56:50 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 108 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 2 | // This f ile is par t of the M icrosoft C RM SDK Cod e Samples. | |||||
| 3 | // | |||||
| 4 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 5 | // | |||||
| 6 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 7 | // Develo pment Tool s and/or o n-line doc umentation . See the se other | |||||
| 8 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 9 | // | |||||
| 10 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 11 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 12 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 13 | // PARTIC ULAR PURPO SE. | |||||
| 14 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 15 | ||||||
| 16 | //<snippet FollowupPl ugin> | |||||
| 17 | using Syst em; | |||||
| 18 | using Syst em.Service Model; | |||||
| 19 | ||||||
| 20 | // Microso ft Dynamic s CRM name space(s) | |||||
| 21 | using Micr osoft.Xrm. Sdk; | |||||
| 22 | ||||||
| 23 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 24 | { | |||||
| 25 | pu blic class FollowupP lugin: IPl ugin | |||||
| 26 | { | |||||
| 27 | /// <summary> | |||||
| 28 | // / A plug-i n that cre ates a fol low-up tas k activity when a ne w account is created . | |||||
| 29 | /// </summary> | |||||
| 30 | // / <remarks >Register this plug- in on the Create mes sage, acco unt entity , | |||||
| 31 | // / and asyn chronous m ode. | |||||
| 32 | // / </remark s> | |||||
| 33 | pu blic void Execute(IS erviceProv ider servi ceProvider ) | |||||
| 34 | { | |||||
| 35 | //Extrac t the trac ing servic e for use in debuggi ng sandbox ed plug-in s. | |||||
| 36 | ITracing Service tr acingServi ce = | |||||
| 37 | (ITr acingServi ce)service Provider.G etService( typeof(ITr acingServi ce)); | |||||
| 38 | ||||||
| 39 | //<snipp etFollowup Plugin1> | |||||
| 40 | // Obtai n the exec ution cont ext from t he service provider. | |||||
| 41 | IPluginE xecutionCo ntext cont ext = (IPl uginExecut ionContext ) | |||||
| 42 | serv iceProvide r.GetServi ce(typeof( IPluginExe cutionCont ext)); | |||||
| 43 | //</snip petFollowu pPlugin1> | |||||
| 44 | ||||||
| 45 | //<snipp etFollowup Plugin2> | |||||
| 46 | // The I nputParame ters colle ction cont ains all t he data pa ssed in th e message request. | |||||
| 47 | if (cont ext.InputP arameters. Contains(" Target") & & | |||||
| 48 | cont ext.InputP arameters[ "Target"] is Entity) | |||||
| 49 | { | |||||
| 50 | // O btain the target ent ity from t he input p arameters. | |||||
| 51 | Enti ty entity = (Entity) context.In putParamet ers["Targe t"]; | |||||
| 52 | //</ snippetFol lowupPlugi n2> | |||||
| 53 | ||||||
| 54 | // V erify that the targe t entity r epresents an account . | |||||
| 55 | // I f not, thi s plug-in was not re gistered c orrectly. | |||||
| 56 | if ( entity.Log icalName ! = "account ") | |||||
| 57 | return; | |||||
| 58 | ||||||
| 59 | try | |||||
| 60 | { | |||||
| 61 | // Create a task act ivity to f ollow up w ith the ac count cust omer in 7 days. | |||||
| 62 | Entity fol lowup = ne w Entity(" task"); | |||||
| 63 | ||||||
| 64 | followup[" subject"] = "Send e- mail to th e new cust omer."; | |||||
| 65 | followup[" descriptio n"] = | |||||
| 66 | "Follo w up with the custom er. Check if there a re any new issues th at need re solution." ; | |||||
| 67 | followup[" scheduleds tart"] = D ateTime.No w.AddDays( 7); | |||||
| 68 | followup[" schedulede nd"] = Dat eTime.Now. AddDays(7) ; | |||||
| 69 | followup[" category"] = context .PrimaryEn tityName; | |||||
| 70 | ||||||
| 71 | // Refer t o the acco unt in the task acti vity. | |||||
| 72 | if (contex t.OutputPa rameters.C ontains("i d")) | |||||
| 73 | { | |||||
| 74 | Guid r egardingob jectid = n ew Guid(co ntext.Outp utParamete rs["id"].T oString()) ; | |||||
| 75 | string regarding objectidTy pe = "acco unt"; | |||||
| 76 | ||||||
| 77 | follow up["regard ingobjecti d"] = | |||||
| 78 | new En tityRefere nce(regard ingobjecti dType, reg ardingobje ctid); | |||||
| 79 | } | |||||
| 80 | ||||||
| 81 | //<snippet FollowupPl ugin4> | |||||
| 82 | // Obtain the organi zation ser vice refer ence. | |||||
| 83 | IOrganizat ionService Factory se rviceFacto ry = (IOrg anizationS erviceFact ory)servic eProvider. GetService (typeof(IO rganizatio nServiceFa ctory)); | |||||
| 84 | IOrganizat ionService service = serviceFa ctory.Crea teOrganiza tionServic e(context. UserId); | |||||
| 85 | //</snippe tFollowupP lugin4> | |||||
| 86 | ||||||
| 87 | // Create the task i n Microsof t Dynamics CRM. | |||||
| 88 | tracingSer vice.Trace ("Followup Plugin: Cr eating the task acti vity."); | |||||
| 89 | service.Cr eate(follo wup); | |||||
| 90 | } | |||||
| 91 | //<s nippetFoll owupPlugin 3> | |||||
| 92 | catc h (FaultEx ception<Or ganization ServiceFau lt> ex) | |||||
| 93 | { | |||||
| 94 | throw new InvalidPlu ginExecuti onExceptio n("An erro r occurred in the Fo llowupPlug in plug-in .", ex); | |||||
| 95 | } | |||||
| 96 | //</ snippetFol lowupPlugi n3> | |||||
| 97 | ||||||
| 98 | catc h (Excepti on ex) | |||||
| 99 | { | |||||
| 100 | tracingSer vice.Trace ("Followup Plugin: {0 }", ex.ToS tring()); | |||||
| 101 | throw; | |||||
| 102 | } | |||||
| 103 | } | |||||
| 104 | } | |||||
| 105 | } | |||||
| 106 | } | |||||
| 107 | //</snippe tFollowupP lugin> | |||||
| 108 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.