Skip to content

Commit

Permalink
Merge pull request #78 from navikt/NKS-1743_ChangeStoOrder
Browse files Browse the repository at this point in the history
NKS-1743: Updated flow that sets Latest_message_Datetime__c for Thread
  • Loading branch information
vegarduri authored May 22, 2024
2 parents e416ea1 + 939a73e commit e8c9535
Showing 1 changed file with 87 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<name>Assign_thread_Id</name>
<label>Assign thread Id</label>
<locationX>176</locationX>
<locationY>278</locationY>
<locationY>242</locationY>
<assignmentItems>
<assignToReference>Thread.Id</assignToReference>
<operator>Assign</operator>
Expand All @@ -25,17 +25,26 @@
</connector>
</assignments>
<assignments>
<name>Set_values</name>
<label>Set values</label>
<locationX>264</locationX>
<locationY>518</locationY>
<name>Set_Conversation_Summary</name>
<label>Set Conversation Summary</label>
<locationX>352</locationX>
<locationY>758</locationY>
<assignmentItems>
<assignToReference>Thread.CRM_Conversation_Summary__c</assignToReference>
<operator>Add</operator>
<value>
<elementReference>MessageSummaryText</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Message</targetReference>
</connector>
</assignments>
<assignments>
<name>Set_values</name>
<label>Set values</label>
<locationX>440</locationX>
<locationY>566</locationY>
<assignmentItems>
<assignToReference>Thread.CRM_Latest_Message_Datetime__c</assignToReference>
<operator>Assign</operator>
Expand All @@ -44,48 +53,97 @@
</value>
</assignmentItems>
<connector>
<targetReference>Message</targetReference>
<targetReference>Set_Conversation_Summary</targetReference>
</connector>
</assignments>
<decisions>
<name>Is_end_of_chat</name>
<label>Set Latest Message Datetime?</label>
<locationX>352</locationX>
<locationY>458</locationY>
<defaultConnector>
<targetReference>Set_values</targetReference>
</defaultConnector>
<defaultConnectorLabel>Yes</defaultConnectorLabel>
<rules>
<name>No_end_of_chat</name>
<conditionLogic>(1 OR 2) AND (3 OR 4)</conditionLogic>
<conditions>
<leftValueReference>Message.CRM_Event_Type__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>END_OF_CHAT</stringValue>
</rightValue>
</conditions>
<conditions>
<leftValueReference>Message.CRM_Event_Type__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>JOURNAL</stringValue>
</rightValue>
</conditions>
<conditions>
<leftValueReference>Message.CRM_Thread_Type__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>STO</stringValue>
</rightValue>
</conditions>
<conditions>
<leftValueReference>Message.CRM_Thread_Type__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>BTO</stringValue>
</rightValue>
</conditions>
<connector>
<targetReference>Set_Conversation_Summary</targetReference>
</connector>
<label>No</label>
</rules>
</decisions>
<description>Find all messages related to a thread and generate a new Conversation Summary
Set the Latest Message Date Time based on the latest message</description>
Set the Latest Message Date Time based on the latest message</description>
<formulas>
<description>generates text for events</description>
<name>Message_Text_Formula</name>
<dataType>String</dataType>
<expression>IF(ISPICKVAL({!Message.CRM_Type__c},&apos;Event&apos;),
IF(ISPICKVAL({!Message.CRM_Event_Type__c},&apos;END_OF_CHAT&apos;),
&apos;Samtalen ble avsluttet&apos;,
IF(OR(ISPICKVAL({!Message.CRM_Event_Type__c},&apos;QUEUE_TRANSFER&apos;),ISPICKVAL({!Message.CRM_Event_Type__c},&apos;UNIT_TRANSFER&apos;)),
IF(ISPICKVAL({!Message.CRM_Event_Type__c},&apos;END_OF_CHAT&apos;),
&apos;Samtalen ble avsluttet&apos;,
IF(OR(ISPICKVAL({!Message.CRM_Event_Type__c},&apos;QUEUE_TRANSFER&apos;),ISPICKVAL({!Message.CRM_Event_Type__c},&apos;UNIT_TRANSFER&apos;)),
&apos;Samtalen er overført til avdeling &apos; + {!Message.CRM_Message_Text__c},
SUBSTITUTE({!Message.CRM_Message_Text__c}, MID({!LineBreakString},2,1),&apos;&lt;br&gt;&apos;)
)
),
SUBSTITUTE({!Message.CRM_Message_Text__c}, MID({!LineBreakString},2,1),&apos;&lt;br&gt;&apos;)
)</expression>
SUBSTITUTE({!Message.CRM_Message_Text__c},
MID({!LineBreakString},2,1),&apos;&lt;br&gt;&apos;)
)
),
SUBSTITUTE({!Message.CRM_Message_Text__c},
MID({!LineBreakString},2,1),&apos;&lt;br&gt;&apos;)
)</expression>
</formulas>
<formulas>
<name>SenderNameFormula</name>
<dataType>String</dataType>
<expression>IF({!Message.CRM_External_Message__c},
{!Message.CRM_From_First_Name__c},
IF(ISBLANK({!Message.CRM_From_Ident_Formula__c}),
&apos;&apos;,
{!Message.CRM_From_First_Name__c} +&apos;(&apos; + {!Message.CRM_From_Ident_Formula__c} + &apos;)&apos;
)
)</expression>
{!Message.CRM_From_First_Name__c},
IF(ISBLANK({!Message.CRM_From_Ident_Formula__c}),
&apos;&apos;,
{!Message.CRM_From_First_Name__c} +&apos;(&apos; + {!Message.CRM_From_Ident_Formula__c}
+ &apos;)&apos;
)
)</expression>
</formulas>
<interviewLabel>Thread - Sub Flow {!$Flow.CurrentDateTime}</interviewLabel>
<label>Thread - Subflow - Recalculate Message Summary</label>
<loops>
<name>Message</name>
<label>Message</label>
<locationX>176</locationX>
<locationY>398</locationY>
<locationY>350</locationY>
<collectionReference>Message_Collection</collectionReference>
<iterationOrder>Desc</iterationOrder>
<nextValueConnector>
<targetReference>Set_values</targetReference>
<targetReference>Is_end_of_chat</targetReference>
</nextValueConnector>
<noMoreValuesConnector>
<targetReference>Update_thread</targetReference>
Expand Down Expand Up @@ -114,7 +172,7 @@ IF(ISBLANK({!Message.CRM_From_Ident_Formula__c}),
<name>Message_Collection</name>
<label>Message Collection</label>
<locationX>176</locationX>
<locationY>158</locationY>
<locationY>134</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Assign_thread_Id</targetReference>
Expand All @@ -137,7 +195,7 @@ IF(ISBLANK({!Message.CRM_From_Ident_Formula__c}),
<name>Update_thread</name>
<label>Update thread</label>
<locationX>176</locationX>
<locationY>734</locationY>
<locationY>950</locationY>
<inputReference>Thread</inputReference>
</recordUpdates>
<start>
Expand All @@ -153,12 +211,13 @@ IF(ISBLANK({!Message.CRM_From_Ident_Formula__c}),
<name>LineBreakString</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
<text>a
b</text>
b</text>
</textTemplates>
<textTemplates>
<name>MessageSummaryText</name>
<isViewedAsPlainText>true</isViewedAsPlainText>
<text>&lt;p&gt;&lt;b&gt;{!Message.CRM_Sent_Datetime_Formula__c}&lt;/b&gt;&lt;/p&gt;&lt;p&gt;{!Message_Text_Formula}&lt;/p&gt;&lt;p&gt;{!SenderNameFormula} &lt;/p&gt;&lt;br&gt;</text>
<text>&lt;p&gt;&lt;b&gt;{!Message.CRM_Sent_Datetime_Formula__c}&lt;/b&gt;&lt;/p&gt;&lt;p&gt;{!Message_Text_Formula}&lt;/p&gt;&lt;p&gt;{!SenderNameFormula}
&lt;/p&gt;&lt;br&gt;</text>
</textTemplates>
<variables>
<name>lastMessageDate</name>
Expand Down Expand Up @@ -189,4 +248,4 @@ b</text>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>
</Flow>
</Flow>

0 comments on commit e8c9535

Please sign in to comment.