id,name,description,targetType,data,isActive,eventStartIdList,eventStartAllIdList,createdAt,modifiedAt,assignedUserId,assignedUserName,createdById,createdByName,modifiedById,modifiedByName 5ea7d13a946aebc13,Opportunity,"Fires with every save of the opportunity On Creation * Defaults CloseDate if missing Updates: * Close Quarter * Currency Same field * Calculates the Margin * Calculates the Weighted Margin * Sets the Interest Type For Stage=""Closed"" * Sets the Forecast Status=""Closed"" * Ensure that the Win Loss codes are set",Opportunity,"{""list"":[{""type"":""eventStartConditional"",""center"":{""x"":120,""y"":80},""triggerType"":""afterRecordCreated"",""isInterrupting"":false,""id"":""ry9h9ccmmk"",""text"":""Record Created"",""conditionsAll"":[],""conditionsAny"":[],""conditionsFormula"":"""",""description"":null},{""type"":""eventStartConditional"",""center"":{""x"":120,""y"":240},""triggerType"":""afterRecordSaved"",""isInterrupting"":false,""id"":""frxp62bz31"",""text"":""Record Saved"",""conditionsAll"":[],""conditionsAny"":[],""conditionsFormula"":"""",""description"":null},{""type"":""task"",""center"":{""x"":240,""y"":80},""id"":""kwcbpcihm0"",""text"":""Created"",""actionList"":[{""fieldList"":[],""fields"":{},""cid"":0,""id"":""700t30zl1d"",""formula"":""\/\/ Default CloseDate to NOW() + 60 if empty\nifThen(!closeDate,\n closeDate = datetime\\addDays(datetime\\today(), 60)\n);"",""type"":""updateEntity""}],""description"":""Default a number of things if they are empty\n* Close Date""},{""type"":""task"",""center"":{""x"":240,""y"":240},""id"":""5pmmfitjh8"",""text"":""Saved - no action"",""actionList"":[{""fieldList"":[],""fields"":{},""cid"":0,""id"":""g26nbllywl"",""formula"":"""",""type"":""updateEntity""}],""description"":null},{""type"":""gatewayExclusive"",""center"":{""x"":440,""y"":160},""id"":""y5yfoqw47h""},{""startId"":""ry9h9ccmmk"",""endId"":""kwcbpcihm0"",""startDirection"":""r"",""id"":""spk5t69fdi"",""type"":""flow""},{""startId"":""kwcbpcihm0"",""endId"":""y5yfoqw47h"",""startDirection"":""r"",""id"":""9h7uzgpask"",""type"":""flow""},{""startId"":""frxp62bz31"",""endId"":""5pmmfitjh8"",""startDirection"":""r"",""id"":""ielij73w6x"",""type"":""flow""},{""startId"":""5pmmfitjh8"",""endId"":""y5yfoqw47h"",""startDirection"":""r"",""id"":""br61nvjqdy"",""type"":""flow""},{""type"":""task"",""center"":{""x"":240,""y"":380},""id"":""stak6sgun3"",""text"":""Lost Updates"",""actionList"":[{""fieldList"":[""forecastStatus""],""fields"":{""forecastStatus"":{""subjectType"":""value"",""attributes"":{""forecastStatus"":""Pipeline""}}},""cid"":0,""id"":""fqgza5rlt7"",""formula"":""relatedOpportunitiesIds = \"\";\n\ndescription - string\\concatenate(description, \"\\nCode ran\");"",""type"":""updateEntity""}],""description"":""Set:\n* Forecast Status = Pipeline\n* Un-link child opportunities from this one""},{""type"":""eventEnd"",""center"":{""x"":680,""y"":380},""id"":""t4ckrhb1gd"",""text"":""End 1"",""description"":null},{""type"":""task"",""center"":{""x"":600,""y"":160},""id"":""yz9pm4d0gr"",""text"":""Generic Updates"",""actionList"":[{""fieldList"":[],""fields"":{},""cid"":0,""id"":""wttygmhpp7"",""formula"":""\/\/ Update the CloseQuarter field\n$tempMonth = datetime\\month(closeDate);\n$qtr = ($tempMonth - 1)\/3;\n$strQtr = string\\substring($qtr, 0, 1);\n$numQtr = $strQtr + 1;\ncloseQuarter = string\\concatenate(datetime\\year(closeDate),\"Q\",$numQtr);\n\n\/\/ Check that all of the currencies are the same\ns4CurrencySame= amountCurrency == supportCurrency && supportCurrency == servicesCurrency && servicesCurrency == subscriptionCurrency;\n\n\/\/ Calcualte the total value of the order in currency\ns4OrderTotal = amount + support + services + subscription;\ns4OrderTotalCurrency = amountCurrency;\n\n\/\/ Work out the Margin, this is always in GBP\n\/\/ Cannot use s4OrderTotalConverted as this may not have been updated yet\nmargin = amountConverted + supportConverted + servicesConverted + subscriptionConverted - buyPriceConverted;\nmarginCurrency = 'GBP';\n\n\/\/ Calculate the WeightedMargin\nifThenElse(forecastStatus=='Pipeline', s4WeightedMargin=0);\nifThenElse(forecastStatus=='Possible', s4WeightedMargin=(margin * 0.25));\nifThenElse(forecastStatus=='Probable', s4WeightedMargin=(margin * 0.5));\nifThenElse(forecastStatus=='Commit', s4WeightedMargin=(margin * 0.90));\nifThenElse(forecastStatus=='Closed', s4WeightedMargin=(margin));\n\n\/\/ Set the Interest Type, default to 'Other'\ns4InterestType=\"Other\";\nifThen(stage=='Lead' || stage=='Contact Attempted' || stage=='Customer Engaged' || stage=='Discovery Booked' || stage =='Recorded Demo Sent' || stage=='Demo Booked',s4InterestType='Lead');\nifThen(stage=='Prospecting' || stage=='Live Demo Booked' || stage=='Eval Booked' || stage=='Proposal' || stage=='Verbal' || stage=='Sales Won' || stage=='Won - Finance' || stage=='Won', s4InterestType='Opportunity');"",""type"":""updateEntity""}],""description"":null},{""type"":""eventEnd"",""center"":{""x"":740,""y"":160},""id"":""5vgsvp8c5b"",""text"":""End 2"",""description"":null},{""startId"":""yz9pm4d0gr"",""endId"":""5vgsvp8c5b"",""startDirection"":""r"",""id"":""4eu2woiubz"",""type"":""flow"",""text"":null,""description"":null},{""type"":""gatewayExclusive"",""center"":{""x"":500,""y"":380},""id"":""pqrrce50ll"",""text"":null,""defaultFlowId"":""yydg69t3a8"",""flowList"":[{""id"":""hra6jethlh"",""conditionsAll"":[{""comparison"":""equals"",""subjectType"":""value"",""cid"":0,""fieldToCompare"":""winLossReason"",""type"":""all"",""value"":""TBC""}],""conditionsAny"":[],""conditionsFormula"":""""}],""description"":null},{""type"":""task"",""center"":{""x"":500,""y"":500},""id"":""b06tdfzc3c"",""text"":""Create Task \"Set Win Loss Codes\""",""actionList"":[{""link"":""tasks"",""fieldList"":[""name"",""assignedUser"",""dateEnd"",""status"",""type""],""fields"":{""name"":{""subjectType"":""value"",""attributes"":{""name"":""Set \"Win \/ Loss\" Codes""}},""assignedUser"":{""subjectType"":""field"",""attributes"":{},""field"":""assignedUser""},""dateEnd"":{""subjectType"":""today"",""shiftDays"":""0"",""attributes"":{},""shiftUnit"":""days""},""status"":{""subjectType"":""value"",""attributes"":{""status"":""Not Started""}},""type"":{""subjectType"":""value"",""attributes"":{""type"":""Sales - offline""}}},""cid"":2,""id"":""y5h9d51f8f"",""linkList"":[],""formula"":"""",""type"":""createRelatedEntity""}],""description"":null},{""type"":""eventEnd"",""center"":{""x"":500,""y"":600},""id"":""kefem2hcnc"",""text"":""End 3"",""description"":null},{""startId"":""stak6sgun3"",""endId"":""pqrrce50ll"",""startDirection"":""r"",""id"":""sawlv0c9oo"",""type"":""flow""},{""startId"":""pqrrce50ll"",""endId"":""t4ckrhb1gd"",""startDirection"":""r"",""id"":""yydg69t3a8"",""type"":""flow"",""isDefault"":true},{""startId"":""pqrrce50ll"",""endId"":""b06tdfzc3c"",""startDirection"":""d"",""id"":""hra6jethlh"",""type"":""flow"",""isDefault"":false,""text"":""Win\/Loss = TBC"",""description"":null},{""startId"":""b06tdfzc3c"",""endId"":""kefem2hcnc"",""startDirection"":""d"",""id"":""kl7q43g95i"",""type"":""flow""},{""type"":""eventStartConditional"",""center"":{""x"":120,""y"":380},""triggerType"":""afterRecordSaved"",""isInterrupting"":false,""id"":""6sbtlycj2w"",""text"":""Stage == Closed && Changed"",""conditionsAll"":[{""comparison"":""equals"",""subjectType"":""value"",""cid"":0,""fieldToCompare"":""stage"",""type"":""all"",""value"":""Closed Lost""},{""comparison"":""changed"",""subjectType"":""value"",""cid"":1,""fieldToCompare"":""stage"",""type"":""all""}],""conditionsAny"":[],""conditionsFormula"":"""",""description"":null},{""startId"":""y5yfoqw47h"",""endId"":""yz9pm4d0gr"",""startDirection"":""r"",""id"":""9x0vzdmg21"",""type"":""flow""},{""startId"":""6sbtlycj2w"",""endId"":""stak6sgun3"",""startDirection"":""r"",""id"":""wcfm8xm5na"",""type"":""flow""},{""type"":""eventStartConditional"",""center"":{""x"":120,""y"":780},""triggerType"":""afterRecordSaved"",""isInterrupting"":false,""id"":""anqnovvbyy"",""text"":""Stage Changed"",""conditionsAll"":[{""comparison"":""changed"",""subjectType"":""value"",""cid"":0,""fieldToCompare"":""stage"",""value"":""Lead"",""type"":""all""}],""conditionsAny"":[],""conditionsFormula"":"""",""description"":null},{""type"":""task"",""center"":{""x"":240,""y"":780},""id"":""ykrlal6ojp"",""text"":""Stage Tracking"",""actionList"":[],""description"":null},{""startId"":""anqnovvbyy"",""endId"":""ykrlal6ojp"",""startDirection"":""r"",""id"":""83oo2g62ts"",""type"":""flow""},{""type"":""eventEnd"",""center"":{""x"":500,""y"":780},""id"":""9gmpcab5y6"",""text"":""End 4"",""description"":null},{""startId"":""ykrlal6ojp"",""endId"":""9gmpcab5y6"",""startDirection"":""r"",""id"":""ixxnyfv1te"",""type"":""flow""}],""createdEntitiesData"":{""b06tdfzc3c_y5h9d51f8f"":{""elementId"":""b06tdfzc3c"",""actionId"":""y5h9d51f8f"",""link"":""tasks"",""entityType"":""Task"",""numberId"":0}}}",1,[],"[""ry9h9ccmmk"",""frxp62bz31"",""6sbtlycj2w"",""anqnovvbyy""]","2020-04-28 06:46:18","2020-06-11 12:35:50",1,"Mat Ludlam",1,"Mat Ludlam",1,"Mat Ludlam"