Skip to content

Commit

Permalink
Created platform event Employer Activity Event
Browse files Browse the repository at this point in the history
  • Loading branch information
raac09 committed Dec 20, 2024
1 parent af099ee commit b489fb1
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 31 deletions.
88 changes: 76 additions & 12 deletions force-app/main/default/flows/TAG_Event.flow-meta.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>60.0</apiVersion>
<assignments>
<name>Store_event_date</name>
<label>Store event date</label>
<locationX>1898</locationX>
<locationY>647</locationY>
<assignmentItems>
<assignToReference>StartDateTimeVariable</assignToReference>
<operator>Assign</operator>
<value>
<elementReference>$Record.StartDateTime</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Update_latest_event_date_on_account</targetReference>
</connector>
</assignments>
<decisions>
<name>Is_Event_related_to_IACase</name>
<label>Is Event related to IACase?</label>
Expand All @@ -26,7 +42,7 @@
<decisions>
<name>Is_IA_Case_Number_blank</name>
<label>Is IA Case Number blank?</label>
<locationX>1128</locationX>
<locationX>1172</locationX>
<locationY>971</locationY>
<defaultConnectorLabel>Not blank</defaultConnectorLabel>
<rules>
Expand Down Expand Up @@ -55,7 +71,7 @@
<decisions>
<name>Is_IA_event</name>
<label>Is IA event?</label>
<locationX>1326</locationX>
<locationX>1634</locationX>
<locationY>539</locationY>
<defaultConnectorLabel>No not IA event</defaultConnectorLabel>
<rules>
Expand All @@ -73,6 +89,28 @@
</connector>
<label>Yes is IA event</label>
</rules>
<rules>
<name>Is_IPS_event</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>$Record.RecordTypeName__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>Arbeidsgivermøte</stringValue>
</rightValue>
</conditions>
<conditions>
<leftValueReference>$Record.StartDateTime</leftValueReference>
<operator>GreaterThan</operator>
<rightValue>
<elementReference>$Record.Account.TAG_LastEventDate__c</elementReference>
</rightValue>
</conditions>
<connector>
<targetReference>Store_event_date</targetReference>
</connector>
<label>Is IPS event</label>
</rules>
</decisions>
<decisions>
<name>Is_updated_or_created</name>
Expand Down Expand Up @@ -102,7 +140,7 @@
<decisions>
<name>Subject_equals_pubsub</name>
<label>Subject equals pubsub?</label>
<locationX>754</locationX>
<locationX>908</locationX>
<locationY>323</locationY>
<defaultConnector>
<targetReference>Update_fields</targetReference>
Expand All @@ -127,7 +165,7 @@
<decisions>
<name>Which_Record_Type</name>
<label>Which Record Type?</label>
<locationX>1018</locationX>
<locationX>1106</locationX>
<locationY>863</locationY>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
Expand Down Expand Up @@ -226,7 +264,7 @@
<inputAssignments>
<field>EventMessage__c</field>
<value>
<elementReference>StoreEventValuesForPubSub</elementReference>
<elementReference>StoreEventValues</elementReference>
</value>
</inputAssignments>
<inputAssignments>
Expand All @@ -241,7 +279,7 @@
<stringValue>Created</stringValue>
</value>
</inputAssignments>
<object>PubSub_Event__e</object>
<object>EmployerActivityEvent__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordCreates>
Expand All @@ -252,7 +290,7 @@
<inputAssignments>
<field>EventMessage__c</field>
<value>
<elementReference>StoreEventValuesForPubSub</elementReference>
<elementReference>StoreEventValues</elementReference>
</value>
</inputAssignments>
<inputAssignments>
Expand All @@ -267,7 +305,7 @@
<stringValue>Updated</stringValue>
</value>
</inputAssignments>
<object>PubSub_Event__e</object>
<object>EmployerActivityEvent__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordLookups>
Expand Down Expand Up @@ -336,7 +374,7 @@
<recordLookups>
<name>Get_latest_IA_priority_event</name>
<label>Get latest IA priority event</label>
<locationX>1018</locationX>
<locationX>1106</locationX>
<locationY>647</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
Expand Down Expand Up @@ -424,7 +462,7 @@
<recordUpdates>
<name>Update_account</name>
<label>Update account</label>
<locationX>1018</locationX>
<locationX>1106</locationX>
<locationY>755</locationY>
<connector>
<targetReference>Which_Record_Type</targetReference>
Expand All @@ -448,7 +486,7 @@
<recordUpdates>
<name>Update_fields</name>
<label>Update fields</label>
<locationX>1326</locationX>
<locationX>1634</locationX>
<locationY>431</locationY>
<connector>
<targetReference>Is_IA_event</targetReference>
Expand Down Expand Up @@ -503,8 +541,29 @@
</inputAssignments>
<inputReference>$Record</inputReference>
</recordUpdates>
<recordUpdates>
<name>Update_latest_event_date_on_account</name>
<label>Update latest event date on account</label>
<locationX>1898</locationX>
<locationY>755</locationY>
<filterLogic>and</filterLogic>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value>
<elementReference>$Record.RelatedToAccount__r.Id</elementReference>
</value>
</filters>
<inputAssignments>
<field>TAG_LastEventDate__c</field>
<value>
<elementReference>StartDateTimeVariable</elementReference>
</value>
</inputAssignments>
<object>Account</object>
</recordUpdates>
<start>
<locationX>628</locationX>
<locationX>782</locationX>
<locationY>0</locationY>
<connector>
<targetReference>Subject_equals_pubsub</targetReference>
Expand Down Expand Up @@ -536,6 +595,11 @@
<triggerType>RecordAfterSave</triggerType>
</start>
<status>Active</status>
<textTemplates>
<name>StoreEventValues</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
<text>{&quot;id&quot;:&quot;{!$Record.Id}&quot;, &quot;tema&quot;:&quot;{!$Record.TAG_ActivityType__c}&quot;, &quot;tjeneste&quot;:&quot;{!$Record.TAG_service__c}&quot;, &quot;emne&quot;:&quot;{!$Record.Subject}&quot;, &quot;opprettet_dato&quot;:&quot;{!opprettet_dato_text}&quot;, &quot;endret_dato&quot;:&quot;{!endret_dato_text}&quot;, &quot;virksomhet_orgnr&quot;:&quot;{!$Record.CRM_AccountOrgNumber__c}&quot;, &quot;moete_dato&quot;:&quot;{!moete_dato_text}&quot;, &quot;virksomhet_NAV_enhet&quot;:&quot;{!$Record.TAG_AccountNAVUnit__c}&quot;, &quot;virksomhet_type&quot;:&quot;{!$Record.TAG_AccountOrgType__c}&quot;, &quot;ansatt_NAV_enhet&quot;:&quot;{!$Record.TAG_UserNAVUnit__c}&quot;, &quot;overordnet_virksomhet_id&quot;:&quot;{!$Record.TAG_AccountParentId__c}&quot;, &quot;overordnet_virksomhet_orgnr&quot;:&quot;{!$Record.TAG_AccountParentOrgNumber__c}&quot;, &quot;status&quot;:&quot;{!$Record.TAG_Status__c}&quot;, &quot;kanal&quot;:&quot;{!$Record.Type}&quot;, &quot;region&quot;:&quot;{!$Record.CRM_Region__c}&quot;, &quot;ansatt_NAV_enhet_navn&quot;:&quot;{!$Record.CRM_Unit__c}&quot;, &quot;paaminnelse_dato&quot;:&quot;{!paaminnelse_dato_text}&quot;, &quot;oppgaveposttype_id&quot;:&quot;{!$Record.RecordTypeId}&quot;, &quot;start_tid&quot;:&quot;{!start_tid_text}&quot;, &quot;slutt_tid&quot;:&quot;{!slutt_tid_text}&quot;, &quot;moeteundertype&quot;:&quot;{!$Record.EventSubtype}&quot;, &quot;varighet&quot;:&quot;{!$Record.DurationInMinutes}&quot;, &quot;relatert_til&quot;:&quot;{!$Record.WhatId}&quot;, &quot;relatert_til_hvem&quot;:&quot;{!$Record.WhoId}&quot;, &quot;IA_saksnummer&quot;:&quot;{!$Record.TAG_IACaseNumber__c}&quot;, &quot;IA_undertema&quot;:&quot;{!$Record.IASubtheme__c}&quot;, &quot;IA_samarbeid_id&quot;:&quot;{!$Record.TAG_IACooperationId__c}&quot;, &quot;posttype_navn&quot;:&quot;{!$Record.RecordTypeName__c}&quot;}</text>
</textTemplates>
<textTemplates>
<name>StoreEventValuesForPubSub</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
Expand Down
37 changes: 21 additions & 16 deletions force-app/main/default/flows/TAG_Task.flow-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<decisions>
<name>Is_IA_priority</name>
<label>Is IA priority?</label>
<locationX>1194</locationX>
<locationX>1304</locationX>
<locationY>1247</locationY>
<defaultConnectorLabel>Not IA priority</defaultConnectorLabel>
<rules>
Expand Down Expand Up @@ -62,7 +62,7 @@
<decisions>
<name>Is_Related_to_Account</name>
<label>Is Related to Account?</label>
<locationX>1194</locationX>
<locationX>1304</locationX>
<locationY>839</locationY>
<defaultConnector>
<targetReference>Is_IA_priority</targetReference>
Expand Down Expand Up @@ -112,7 +112,7 @@
<decisions>
<name>Subject_equals_pubsub</name>
<label>Subject equals pubsub?</label>
<locationX>688</locationX>
<locationX>743</locationX>
<locationY>323</locationY>
<defaultConnector>
<targetReference>Update_fields</targetReference>
Expand All @@ -137,7 +137,7 @@
<decisions>
<name>Update_Activity_Date</name>
<label>Update Activity Date</label>
<locationX>1194</locationX>
<locationX>1304</locationX>
<locationY>539</locationY>
<defaultConnector>
<targetReference>Is_Related_to_Account</targetReference>
Expand All @@ -162,7 +162,7 @@
<decisions>
<name>Which_Record_Type</name>
<label>Which Record Type</label>
<locationX>930</locationX>
<locationX>974</locationX>
<locationY>1571</locationY>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
Expand Down Expand Up @@ -256,7 +256,7 @@
<inputAssignments>
<field>EventMessage__c</field>
<value>
<elementReference>StoreTaskValuesForPubSub</elementReference>
<elementReference>StoreTaskValues</elementReference>
</value>
</inputAssignments>
<inputAssignments>
Expand All @@ -271,7 +271,7 @@
<stringValue>Created</stringValue>
</value>
</inputAssignments>
<object>PubSub_Event__e</object>
<object>EmployerActivityEvent__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordCreates>
Expand All @@ -282,7 +282,7 @@
<inputAssignments>
<field>EventMessage__c</field>
<value>
<elementReference>StoreTaskValuesForPubSub</elementReference>
<elementReference>StoreTaskValues</elementReference>
</value>
</inputAssignments>
<inputAssignments>
Expand All @@ -297,13 +297,13 @@
<stringValue>Updated</stringValue>
</value>
</inputAssignments>
<object>PubSub_Event__e</object>
<object>EmployerActivityEvent__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordLookups>
<name>Get_dummy_account_Id</name>
<label>Get dummy account Id</label>
<locationX>1062</locationX>
<locationX>1172</locationX>
<locationY>947</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
Expand Down Expand Up @@ -388,7 +388,7 @@
<recordLookups>
<name>Get_latest_IA_priority_task</name>
<label>Get latest IA priority task</label>
<locationX>930</locationX>
<locationX>974</locationX>
<locationY>1355</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
Expand Down Expand Up @@ -425,7 +425,7 @@
<recordUpdates>
<name>Set_Activity_Date_to_today</name>
<label>Set Activity Date to today</label>
<locationX>1062</locationX>
<locationX>1172</locationX>
<locationY>647</locationY>
<connector>
<targetReference>Is_Related_to_Account</targetReference>
Expand Down Expand Up @@ -497,7 +497,7 @@
<recordUpdates>
<name>Update_account</name>
<label>Update account</label>
<locationX>930</locationX>
<locationX>974</locationX>
<locationY>1463</locationY>
<connector>
<targetReference>Which_Record_Type</targetReference>
Expand All @@ -521,7 +521,7 @@
<recordUpdates>
<name>Update_AccountOrgType2_field</name>
<label>Update AccountOrgType2 field</label>
<locationX>1062</locationX>
<locationX>1172</locationX>
<locationY>1055</locationY>
<connector>
<targetReference>Is_IA_priority</targetReference>
Expand All @@ -545,7 +545,7 @@
<recordUpdates>
<name>Update_fields</name>
<label>Update fields</label>
<locationX>1194</locationX>
<locationX>1304</locationX>
<locationY>431</locationY>
<connector>
<targetReference>Update_Activity_Date</targetReference>
Expand Down Expand Up @@ -601,7 +601,7 @@
<inputReference>$Record</inputReference>
</recordUpdates>
<start>
<locationX>562</locationX>
<locationX>617</locationX>
<locationY>0</locationY>
<connector>
<targetReference>Subject_equals_pubsub</targetReference>
Expand All @@ -626,6 +626,11 @@
<triggerType>RecordAfterSave</triggerType>
</start>
<status>Active</status>
<textTemplates>
<name>StoreTaskValues</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
<text>{&quot;id&quot;:&quot;{!$Record.Id}&quot;, &quot;tema&quot;:&quot;{!$Record.TAG_ActivityType__c}&quot;, &quot;tjeneste&quot;:&quot;{!$Record.TAG_service__c}&quot;, &quot;emne&quot;:&quot;{!$Record.Subject}&quot;, &quot;opprettet_dato&quot;:&quot;{!opprettet_dato_text}&quot;, &quot;endret_dato&quot;:&quot;{!endret_dato_text}&quot;, &quot;virksomhet_orgnr&quot;:&quot;{!$Record.CRM_AccountOrgNumber__c}&quot;, &quot;forfallsdato&quot;:&quot;{!forfallsdato_text}&quot;, &quot;virksomhet_NAV_enhet&quot;:&quot;{!$Record.TAG_AccountNAVUnit__c}&quot;, &quot;virksomhet_type&quot;:&quot;{!$Record.TAG_AccountOrgType__c}&quot;, &quot;ansatt_NAV_enhet&quot;:&quot;{!$Record.TAG_UserNAVUnit__c}&quot;, &quot;overordnet_virksomhet_id&quot;:&quot;{!$Record.TAG_AccountParentId__c}&quot;, &quot;overordnet_virksomhet_orgnr&quot;:&quot;{!$Record.TAG_AccountParentOrgNumber__c}&quot;, &quot;status&quot;:&quot;{!$Record.TAG_Status__c}&quot;, &quot;prioritet&quot;:&quot;{!$Record.Priority}&quot;, &quot;kanal&quot;:&quot;{!$Record.Type}&quot;, &quot;oppgaveundertype&quot;:&quot;{!$Record.TaskSubtype}&quot;, &quot;region&quot;:&quot;{!$Record.CRM_Region__c}&quot;, &quot;ansatt_NAV_enhet_navn&quot;:&quot;{!$Record.CRM_Unit__c}&quot;, &quot;paaminnelse_dato&quot;:&quot;{!paaminnelse_dato_text}&quot;, &quot;oppgaveposttype_id&quot;:&quot;{!$Record.RecordTypeId}&quot;, &quot;relatert_til&quot;:&quot;{!$Record.WhatId}&quot;, &quot;relatert_til_hvem&quot;:&quot;{!$Record.WhoId}&quot;, &quot;IA_saksnummer&quot;:&quot;{!$Record.TAG_IACaseNumber__c}&quot;, &quot;IA_undertema&quot;:&quot;{!$Record.IASubtheme__c}&quot;, &quot;IA_samarbeid_id&quot;:&quot;{!$Record.TAG_IACooperationId__c}&quot;, &quot;posttype_navn&quot;:&quot;{!$Record.RecordTypeName__c}&quot;}</text>
</textTemplates>
<textTemplates>
<name>StoreTaskValuesForPubSub</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
Expand Down
6 changes: 3 additions & 3 deletions force-app/main/default/flows/Tag_Event_Listener.flow-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@
<connector>
<targetReference>Create_Application_Log_Action_1</targetReference>
</connector>
<object>PubSub_Event__e</object>
<object>EmployerActivityEvent__e</object>
<triggerType>PlatformEvent</triggerType>
</start>
<status>Obsolete</status>
<status>Draft</status>
<textTemplates>
<name>FetchValues</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
<text>&lt;p&gt;{&quot;Uuid&quot;:&quot;{!$Record.EventUuid}&quot;,&amp;nbsp;&quot;ReplayId&quot;:&quot;{!$Record.ReplayId}&quot;, &quot;Date&quot;:&quot;{!$Record.CreatedDate}&quot;, &quot;EventType&quot;:&quot;&lt;span style=&quot;background-color: rgb(255, 255, 255); color: rgb(68, 68, 68);&quot;&gt;{!$Record.EventType__c}&lt;/span&gt;&quot;, &quot;EventMessage&quot;:&quot;{!$Record.EventMessage__c}&quot;}&lt;/p&gt;</text>
<text>{&quot;Uuid&quot;:&quot;{!$Record.EventUuid}&quot;, &quot;ReplayId&quot;:&quot;{!$Record.ReplayId}&quot;, &quot;Date&quot;:&quot;{!$Record.CreatedDate}&quot;, &quot;EventType&quot;:&quot;{!$Record.EventType__c}&quot;, &quot;EventObject&quot;:&quot;{!$Record.EventObject__c}&quot;, &quot;EventMessage&quot;:&quot;{!$Record.EventMessage__c}&quot;}</text>
</textTemplates>
<variables>
<name>GetFields</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<eventType>HighVolume</eventType>
<label>Employer Activity Event</label>
<pluralLabel>Employer Activity Events</pluralLabel>
<publishBehavior>PublishImmediately</publishBehavior>
</CustomObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>EventMessage__c</fullName>
<externalId>false</externalId>
<isFilteringDisabled>false</isFilteringDisabled>
<isNameField>false</isNameField>
<isSortingDisabled>false</isSortingDisabled>
<label>Event Message</label>
<length>131072</length>
<type>LongTextArea</type>
<visibleLines>3</visibleLines>
</CustomField>
Loading

0 comments on commit b489fb1

Please sign in to comment.