Skip to content

Commit

Permalink
Merge pull request #336 from navikt/TOLK-2363
Browse files Browse the repository at this point in the history
TOLK-2363 : Automatisk påmeld deltakere på venteliste når antall deltakere utvides
  • Loading branch information
olsenrasmus authored Apr 23, 2024
2 parents 50a5715 + 6a44cec commit 7a5e343
Showing 1 changed file with 235 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>60.0</apiVersion>
<assignments>
<name>assign_participant_to_course</name>
<label>assign participant to course</label>
<locationX>138</locationX>
<locationY>971</locationY>
<assignmentItems>
<assignToReference>Loop_through_waiting_participants_and_assign.Status__c</assignToReference>
<operator>Assign</operator>
<value>
<stringValue>Påmeldt</stringValue>
</value>
</assignmentItems>
<assignmentItems>
<assignToReference>registrations</assignToReference>
<operator>Add</operator>
<value>
<elementReference>Loop_through_waiting_participants_and_assign</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Loop_through_waiting_participants_and_assign</targetReference>
</connector>
</assignments>
<assignments>
<name>number_of_seats_left</name>
<label>number of seats left</label>
<locationX>50</locationX>
<locationY>539</locationY>
<assignmentItems>
<assignToReference>numberOfSeatsLeft</assignToReference>
<operator>Assign</operator>
<value>
<elementReference>availableseatsleftCheck</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Loop_through_waiting_participants_and_assign</targetReference>
</connector>
</assignments>
<assignments>
<name>reduce_number_of_seats_left</name>
<label>reduce number of seats left</label>
<locationX>138</locationX>
<locationY>863</locationY>
<assignmentItems>
<assignToReference>numberOfSeatsLeft</assignToReference>
<operator>Subtract</operator>
<value>
<numberValue>1.0</numberValue>
</value>
</assignmentItems>
<connector>
<targetReference>assign_participant_to_course</targetReference>
</connector>
</assignments>
<decisions>
<name>chech_if_its_seats_left</name>
<label>chech if its seats left</label>
<locationX>270</locationX>
<locationY>755</locationY>
<defaultConnector>
<targetReference>update_waiting_participant</targetReference>
</defaultConnector>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>seats_left</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>numberOfSeatsLeft</leftValueReference>
<operator>NotEqualTo</operator>
<rightValue>
<numberValue>0.0</numberValue>
</rightValue>
</conditions>
<connector>
<targetReference>reduce_number_of_seats_left</targetReference>
</connector>
<label>seats left</label>
</rules>
</decisions>
<decisions>
<name>check_if_there_is_more_available_seats</name>
<label>check if there is more available seats</label>
<locationX>182</locationX>
<locationY>323</locationY>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>more_available_seats</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>availableseatsleftCheck</leftValueReference>
<operator>GreaterThan</operator>
<rightValue>
<numberValue>0.0</numberValue>
</rightValue>
</conditions>
<connector>
<targetReference>get_waiting_course_registrations</targetReference>
</connector>
<label>more available seats</label>
</rules>
</decisions>
<description>When max number of participants is changed, this flow loops through waiting participants and add them to the course.</description>
<environments>Default</environments>
<formulas>
<name>availableseatsleftCheck</name>
<dataType>Number</dataType>
<expression>{!$Record.MaxNumberOfParticipants__c} - {!$Record.NumberOfParticipants__c}</expression>
<scale>0</scale>
</formulas>
<interviewLabel>Auto assign waiting participants to Course {!$Flow.CurrentDateTime}</interviewLabel>
<label>Auto assign waiting participants to Course</label>
<loops>
<name>Loop_through_waiting_participants_and_assign</name>
<label>Loop through waiting participants and assign</label>
<locationX>50</locationX>
<locationY>647</locationY>
<collectionReference>get_waiting_course_registrations</collectionReference>
<iterationOrder>Asc</iterationOrder>
<nextValueConnector>
<targetReference>chech_if_its_seats_left</targetReference>
</nextValueConnector>
<noMoreValuesConnector>
<targetReference>Copy_1_of_update_waiting_participant</targetReference>
</noMoreValuesConnector>
</loops>
<processMetadataValues>
<name>BuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>CanvasMode</name>
<value>
<stringValue>AUTO_LAYOUT_CANVAS</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>OriginBuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processType>AutoLaunchedFlow</processType>
<recordLookups>
<name>get_waiting_course_registrations</name>
<label>get waiting course registrations</label>
<locationX>50</locationX>
<locationY>431</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>number_of_seats_left</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>Status__c</field>
<operator>EqualTo</operator>
<value>
<stringValue>Venteliste</stringValue>
</value>
</filters>
<filters>
<field>Course__c</field>
<operator>EqualTo</operator>
<value>
<elementReference>$Record.Id</elementReference>
</value>
</filters>
<getFirstRecordOnly>false</getFirstRecordOnly>
<object>CourseRegistration__c</object>
<sortField>CreatedDate</sortField>
<sortOrder>Asc</sortOrder>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<recordUpdates>
<name>Copy_1_of_update_waiting_participant</name>
<label>Copy 1 of update waiting participant</label>
<locationX>50</locationX>
<locationY>1247</locationY>
<inputReference>registrations</inputReference>
</recordUpdates>
<recordUpdates>
<name>update_waiting_participant</name>
<label>update waiting participant</label>
<locationX>402</locationX>
<locationY>863</locationY>
<inputReference>registrations</inputReference>
</recordUpdates>
<start>
<locationX>56</locationX>
<locationY>0</locationY>
<connector>
<targetReference>check_if_there_is_more_available_seats</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>MaxNumberOfParticipants__c</field>
<operator>IsChanged</operator>
<value>
<booleanValue>true</booleanValue>
</value>
</filters>
<filters>
<field>Waitinglist__c</field>
<operator>GreaterThan</operator>
<value>
<numberValue>0.0</numberValue>
</value>
</filters>
<object>Course__c</object>
<recordTriggerType>Update</recordTriggerType>
<triggerType>RecordAfterSave</triggerType>
</start>
<status>Active</status>
<variables>
<name>numberOfSeatsLeft</name>
<dataType>Number</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
<scale>2</scale>
</variables>
<variables>
<name>registrations</name>
<dataType>SObject</dataType>
<isCollection>true</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
<objectType>CourseRegistration__c</objectType>
</variables>
</Flow>

0 comments on commit 7a5e343

Please sign in to comment.