Hi Satish,
You could trigger the flow when a customer journey is Stopped(Status reason field), because when a customer journey expires, it will become into stopped status.
Then create a new journey record from data of the expired record, for example:
Action properties:(The sample action will create a new journey with same tiles as the expired record has.)
Name: [existing record name 123
Start date and time: utcNow()
End date and time: formatDateTime(addDays(utcnow(),30),'dd-MMMM-yyyy')
Time zone: [existing record time zone
Content settings: msdyncrm_contentsettingss/([existing record content settings)
Status: Active
Status reason: Draft
Workflow definition: [existing record workflow definition
The most important part is the workflow definition(tiles), it is structured in JSON format, please take some time to learn about it.
For example, the structure of a simple customer journey will look like below:
(Segment -> Email)
The JSON is stored in msdyncrm_workflowdefinition field of Customer Journey entity.
[
{
"ActivityTypeId": "bpf_root",
"ParentBranchId": 0,
"ParentRelationshipType": "Default",
"ActivityId": "01",
"Properties": {
"Items": [
{
"ItemId": null,
"ActivityTypeId": "bpf_root",
"Title": "Undefined",
"Name": "New bpf_root",
"ActivityItemId": 0
},
{
"ItemId": null,
"ActivityTypeId": "bpf_root",
"Title": "Undefined",
"Name": "New bpf_root",
"ActivityItemId": 1
}
]
},
"TileId": "bpf_root",
"ParentActivityId": null
},
{
"ActivityTypeId": "Segment",
"Properties": {
"Items": [
{
"ItemId": null,
"ActivityTypeId": "Segment",
"Title": null,
"Name": "New Segment",
"ActivityItemId": 29,
"SegmentMergeMethod": "Union",
"ContainmentMethod": "Inclusion",
"IsNameSystemDefined": false,
"Description": null
},
{
"ActivityTypeId": "SegmentItem",
"ActivityItemId": 30,
"Name": "Clofly",
"EntityLogicalName": "msdyncrm_segment",
"ItemId": "2885c09b-b127-eb11-a813-000d3aa080ec",
"ContainmentMethod": "Inclusion",
"DciSegmentName": "SEGMENT_CRM_ID_2885c09bb127eb11a813000d3aa080ec",
"SegmentDisplayName": "Clofly",
"SegmentSourceType": "Segment",
"Title": null,
"IsNameSystemDefined": false,
"Description": null
}
]
},
"EntityTarget": "contact",
"TileId": "mktAudience",
"ParentActivityId": "01",
"ParentBranchId": 0,
"ActivityId": "01_6"
},
{
"ActivityTypeId": "Email",
"Properties": {
"Items": [
{
"ItemId": "8a68c12e-b027-eb11-a813-000d3aa080ec",
"ActivityTypeId": "Email",
"Title": null,
"Name": "11-16-01",
"ActivityItemId": 38,
"IsNameSystemDefined": false,
"Description": null,
"EntityLogicalName": "msdyncrm_marketingemail",
"ExpiryEnabled": false,
"ExpiryDate": "2020-12-01",
"ExpiryHour": 0,
"SchedulingConfiguration": null,
"ABTestConfiguration": null
}
]
},
"EntityTarget": "contact",
"TileId": "email",
"ParentActivityId": "01_6",
"ParentBranchId": 0,
"ParentRelationshipType": "Default",
"ActivityId": "01_6_8"
}
]
If you only want to change segment and marketing email to new value:
In Segment node, replace value of ItemId and DciSegmentName properties with the new.
In Email node, replace value of ItemId property to the new.
(DciSegmentName equals to value of msdyncrm_segmentqueryname attribute of segment.)
In conclusion, please refer to following article to do basic operations on Customer Journey using the API:
https://docs.microsoft.com/en-us/dynamics365/marketing/developer/basic-operations-on-customer-journey
Regards,
Clofly