Produced by Araxis Merge on 2/1/2017 2:56:52 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\Process\CustomWorkflowActivities\DateChecker | DateChecker.cs | Tue Dec 20 19:51:45 2016 UTC |
| 2 | Wed Feb 1 19:56:52 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 112 |
| 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 D ynamics CR M SDK code 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 DateChecke r> | |||||
| 17 | using Syst em; | |||||
| 18 | using Syst em.Activit ies; | |||||
| 19 | ||||||
| 20 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.dll a ssembly | |||||
| 21 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 22 | using Micr osoft.Xrm. Sdk; | |||||
| 23 | using Micr osoft.Xrm. Sdk.Query; | |||||
| 24 | ||||||
| 25 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.Workf low.dll as sembly | |||||
| 26 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 27 | using Micr osoft.Xrm. Sdk.Workfl ow; | |||||
| 28 | ||||||
| 29 | // These n amespaces are found in the Mic rosoft.Crm .Sdk.Proxy .dll assem bly | |||||
| 30 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 31 | using Micr osoft.Crm. Sdk.Messag es; | |||||
| 32 | ||||||
| 33 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 34 | { | |||||
| 35 | /// <s ummary> | |||||
| 36 | /// Ch ecks if th e "Est. Cl ose Date" is greater than 10 d ays. If it is, | |||||
| 37 | /// se nd an emai l to the a dministrat or so that s/he can verify clo se date | |||||
| 38 | /// wi th the own er of the opportunit y. | |||||
| 39 | /// In put argume nts: | |||||
| 40 | /// "Opportuni ty". Type: EntityRef erence. Is the oppor tunity ent ity. | |||||
| 41 | /// Ou tput argum ent: | |||||
| 42 | /// None. | |||||
| 43 | /// </ summary> | |||||
| 44 | public sealed pa rtial clas s DateChec ker : Code Activity | |||||
| 45 | { | |||||
| 46 | // / <summary > | |||||
| 47 | // / Checks i f the "Est . Close Da te" is gre ater than 10 days. I f it is, | |||||
| 48 | // / send an email to t he adminis trator so that s/he can verify close dat e | |||||
| 49 | // / with the owner of the opport unity. | |||||
| 50 | // / </summar y> | |||||
| 51 | pr otected ov erride voi d Execute( CodeActivi tyContext executionC ontext) | |||||
| 52 | { | |||||
| 53 | IWorkflo wContext c ontext = e xecutionCo ntext.GetE xtension<I WorkflowCo ntext>(); | |||||
| 54 | IOrg anizationS erviceFact ory servic eFactory = | |||||
| 55 | executionC ontext.Get Extension< IOrganizat ionService Factory>() ; | |||||
| 56 | IOrg anizationS ervice ser vice = | |||||
| 57 | serviceFac tory.Creat eOrganizat ionService (context.U serId); | |||||
| 58 | ||||||
| 59 | // Get o pportunity entity | |||||
| 60 | Entity o pportunity = service .Retrieve( "opportuni ty", | |||||
| 61 | this .inputOppo rtunity.Ge t(executio nContext). Id, new Co lumnSet("e stimatedcl osedate")) ; | |||||
| 62 | ||||||
| 63 | // Calul ate 10 day s from tod ay | |||||
| 64 | DateTime todayPlus Ten = Date Time.UtcNo w.AddDays( 10.0); | |||||
| 65 | ||||||
| 66 | // Check "Est. Clo se Date" | |||||
| 67 | if (oppo rtunity.Co ntains("es timatedclo sedate")) | |||||
| 68 | { | |||||
| 69 | Date Time estCl oseDate = (DateTime) opportunit y["estimat edclosedat e"]; | |||||
| 70 | if ( DateTime.C ompare(est CloseDate, todayPlus Ten) > 0) | |||||
| 71 | { | |||||
| 72 | // Need sy stem user id for act ivity part y | |||||
| 73 | WhoAmIRequ est system UserReques t = new Wh oAmIReques t(); | |||||
| 74 | WhoAmIResp onse syste mUser = | |||||
| 75 | (WhoAm IResponse) service.Ex ecute(syst emUserRequ est); | |||||
| 76 | ||||||
| 77 | // Create an activit y party fo r the emai l | |||||
| 78 | Entity[] a ctivityPar ty = new E ntity[1]; | |||||
| 79 | activityPa rty[0] = n ew Entity( "activityp arty"); | |||||
| 80 | activityPa rty[0]["pa rtyid"] = | |||||
| 81 | new En tityRefere nce("syste muser", sy stemUser.U serId); | |||||
| 82 | ||||||
| 83 | // Create an email m essage | |||||
| 84 | Entity ema il = new E ntity("ema il"); | |||||
| 85 | email.Logi calName = "email"; | |||||
| 86 | email["sub ject"] = | |||||
| 87 | "Warni ng: Close date has b een extend ed more th an 10 days ."; | |||||
| 88 | email["des cription"] = "Verify close dat e is corre ct."; | |||||
| 89 | email["to" ] = activi tyParty; | |||||
| 90 | email["fro m"] = acti vityParty; | |||||
| 91 | email["reg ardingobje ctid"] = o pportunity .ToEntityR eference() ; | |||||
| 92 | Guid email Id = servi ce.Create( email); | |||||
| 93 | ||||||
| 94 | // Send em ail | |||||
| 95 | SendEmailR equest sen dEmailRequ est = new SendEmailR equest(); | |||||
| 96 | sendEmailR equest.Ema ilId = ema ilId; | |||||
| 97 | sendEmailR equest.Iss ueSend = t rue; | |||||
| 98 | sendEmailR equest.Tra ckingToken = ""; | |||||
| 99 | SendEmailR esponse se ndEmailRes ponse = | |||||
| 100 | (SendE mailRespon se)service .Execute(s endEmailRe quest); | |||||
| 101 | } | |||||
| 102 | } | |||||
| 103 | } | |||||
| 104 | ||||||
| 105 | // Define In put/Output Arguments | |||||
| 106 | [R equiredArg ument] | |||||
| 107 | [I nput("Oppo rtunity")] | |||||
| 108 | [R eferenceTa rget("oppo rtunity")] | |||||
| 109 | pu blic InArg ument<Enti tyReferenc e> inputOp portunity { get; set ; } | |||||
| 110 | } | |||||
| 111 | } | |||||
| 112 | //</snippe tDateCheck er> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.