donavalli
(Ravi Teja Donavalli)
April 1, 2025, 5:52pm
1
Hi All,
I have a requirement to add 30 days to end date and if that date is more than 30 days from now say YES and if that date is in 30 days from now say NO, active users it should say NO.
Here is the transform.
This logic is working fine for users who have end date and saying YES or NO, but failing for active users who don’t have end date.
{
“name”: “End Date 30 Days Out”,
“type”: “dateCompare”,
“attributes”: {
“firstDate”: “now”,
“secondDate”: {
“type”: “dateFormat”,
“attributes”: {
“inputFormat”: “yyyy-MM-dd”,
“outputFormat”: “ISO8601”,
“input”: {
“attributes”: {
“input”: {
“attributes”: {
“input”: {
“attributes”: {
“endDate”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “endDate”
}
},
“value”: “#if ($endDate) $endDate #else ‘now’ #end ”
},
“type”: “static”
},
“inputFormat”: “MM/dd/yyyy K s ‘AM UTC’”,
“outputFormat”: “ISO8601”
},
“type”: “dateFormat”
},
“expression”: “+30d/d”,
“roundUp”: “false”
},
“type”: “dateMath”
}
}
},
“operator”: “lte”,
“positiveCondition”: “NO”,
“negativeCondition”: “YES”
},
“internal”: false
}
Thank You
It’s missing that logic in the transform. Currently, you’re only doing the (now or enddate) + 30-day compare with today.
pavya
(pravin Dhamdhere)
April 2, 2025, 6:12am
3
Hi @donavalli ,
{
"name": "End Date 30 Days Out",
"type": "dateCompare",
"attributes": {
"firstDate": "now",
"secondDate": {
"type": "dateFormat",
"attributes": {
"inputFormat": "yyyy-MM-dd",
"outputFormat": "ISO8601",
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"endDate": {
"type": "identityAttribute",
"attributes": {
"name": "endDate"
}
},
"value": "#if($endDate) $endDate #else '2999-12-31' #end"
},
"type": "static"
},
"inputFormat": "MM/dd/yyyy K:m:s 'AM UTC'",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"expression": "+30d/d",
"roundUp": "false"
},
"type": "dateMath"
}
}
},
"operator": "lte",
"positiveCondition": "NO",
"negativeCondition": "YES"
},
"internal": false
}
Try this one in this transform updated the value field to set the end date as 2999-12-31 when endDate is missing.
thank you.
donavalli
(Ravi Teja Donavalli)
April 2, 2025, 12:14pm
4
Hi @pavya ,
Tried this but still failing for active users.
pavya
(pravin Dhamdhere)
April 2, 2025, 12:20pm
5
Hi @donavalli ,
can you please try below value for the transform .
#if ($endDate && !$endDate.isEmpty()) $endDate #else ‘2999-12-31’ #end
Thank you .
donavalli
(Ravi Teja Donavalli)
April 2, 2025, 12:59pm
6
Hi @pavya ,
Still failing for active users, this is the error I am getting.
Thank You
. Try this, but remove the comments:
{
"name": "End Date 30 Days Out",
"type": "dateCompare",
"attributes": {
"firstDate": "now",
"secondDate": {
"type": "dateFormat",
"attributes": {
"inputFormat": "yyyy-MM-dd'T'HH:mm" #fixed this value,
"outputFormat": "ISO8601",
"input": {
"type": "dateMath",
"attributes": {
"input": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "firstValid",
"attributes": {
"values": [
{
"type": "identityAttribute",
"attributes": {
"name": "endDate" #assuming that this is the same format as the default value and the inputFormat
}
},
"MM/dd/yyyy K:m:s 'AM UTC'" #default value of your choice
],
"ignoreErrors": false
}
}
},
"inputFormat": "MM/dd/yyyy K:m:s 'AM UTC'",
"outputFormat": "ISO8601"
}
},
"expression": "+30d/d",
"roundUp": "false"
}
}
},
"operator": "lte",
"positiveCondition": "NO",
"negativeCondition": "YES"
},
"internal": false
}
1 Like
donavalli
(Ravi Teja Donavalli)
April 2, 2025, 1:42pm
8
Hi @phil_awlings ,
Now its failing for all users.
Ravi Teja Donavalli:
I have a requirement to add 30 days to end date and if that date is more than 30 days from now say YES and if that date is in 30 days from now say NO, active users it should say NO.
Here is the transform.
This logic is working fine for users who have end date and saying YES or NO, but failing for active users who don’t have end date.
Structually, you mean this if I’m not mistaken:
If End Date does not exist
Return NO.
Else
If End Date > today
Return YES
Else
Return NO.
End if
End if
The 30 days calculation is a red herring.
donavalli
(Ravi Teja Donavalli)
April 2, 2025, 5:20pm
10
Hi @David_Norris ,
If users don’t have endDate set NO, if user has end date if that is more than 30 days from today say Yes, if end date is less than 30 days from today say NO.
LoL…now that’s different from the initial requirement.
With the updated requirement.
If End Date does not exist
Return NO.
Else
Return (End Date > [today+30d]) ? YES: NO.
End if
With this view. Now, you can see, you only need ‘now’ once.
Core of the question is: Is end date beyond the next 30 days.
donavalli
(Ravi Teja Donavalli)
April 2, 2025, 7:49pm
12
HI @David_Norris ,
sorry If I confuse, all I am looking to see user end date and see if that end date is more than 30 days or not and say YES or NO, for active users there will be no end date so I want to make then as NO..
With this current logic I am able to calculate YES or NO for terminated users, but failing for active users where they don’t have end date.
Here is my end date value 02/10/2025 0:0:0 AM UTC for terminated users.
{
"id": "6a46e253-c3e4-4dc7-a216-f86568022b8a",
"name": "End Date 30 Days Out",
"type": "dateCompare",
"attributes": {
"firstDate": "now",
"secondDate": {
"type": "dateFormat",
"attributes": {
"inputFormat": "yyyy-MM-dd",
"outputFormat": "ISO8601",
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"endDate": {
"type": "identityAttribute",
"attributes": {
"name": "endDate"
}
},
"value": "#if($endDate) $endDate #else 'now' #end"
},
"type": "static"
},
"inputFormat": "MM/dd/yyyy K:m:s 'AM UTC'",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"expression": "+30d/d",
"roundUp": "false"
},
"type": "dateMath"
}
}
},
"operator": "lte",
"positiveCondition": "NO",
"negativeCondition": "YES"
},
"internal": false
}
Thank you
@donavalli Try below I hope this helps
{
"name": "Test - Static - Calculate TerminationOffset",
"type": "static",
"attributes": {
"isInactive30Day": {
"type": "dateCompare",
"attributes": {
"firstDate": "now",
"secondDate": {
"type": "dateFormat",
"attributes": {
"inputFormat": "yyyy-MM-dd'T'HH:mm",
"outputFormat": "ISO8601",
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"values": [
{
"attributes": {
"attributeName": "TERMINATION_DATE",
"sourceName": "Workday"
},
"type": "accountAttribute"
},
"01/01/2070"
]
},
"type": "firstValid"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"expression": "+30d/d",
"roundUp": "false"
},
"type": "dateMath"
}
}
},
"operator": "lte",
"positiveCondition": "false",
"negativeCondition": "true"
}
},
"value": "#if($isInactive30Day =='true')YES#{else}NO#end"
},
"internal": false
}
donavalli
(Ravi Teja Donavalli)
April 4, 2025, 12:31pm
14
@sagar_kamalakar ,
Tried this make some modifications and not working.
Thank you
vsandhu1
(Vipinjeet Sandhu)
April 4, 2025, 1:58pm
15
Hi Ravi,
I know this isn’t a solution for you, but it is an explanation as why your original transform failed: Per the DateFormat transform documentation (just above the “Examples” section) is:
Important This transform does not currently support the “now” keyword as an input value
The DateCompare transform does support the now
keyword, so that may be the source of your mistake.
Your two innermost transforms are the location:
"input": {
"attributes": {
"input": {
"attributes": {
"endDate": {
"type": "identityAttribute",
"attributes": {
"name": "endDate"
}
},
"value": "#if($endDate) $endDate #else ‘now’ #end"
},
"type": "static"
},
"inputFormat": "MM/dd/yyyy K:m:s ‘AM UTC’",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
}
gogubapu
(bapu gogu)
April 4, 2025, 2:19pm
16
Hi @donavalli ,
Find below transform to achieve your case:
{
"name": "Add 30Days to EndDate and Compare",
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "static",
"attributes": {
"firstDate": {
"attributes": {
"expression": "+30d",
"input": {
"attributes": {
"input": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "Workday",
"attributeName": "TERMINATION_DATE"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "01/01/1111"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"roundUp": true
},
"type": "dateMath"
},
"value": "$firstDate"
}
},
"secondDate": "now",
"operator": "gte",
"positiveCondition": "Yes",
"negativeCondition": "No"
}
}
in the transform am used firstvalid because, if the value comes null, the date compare transform throws an error. i have given some value.
It is working as expect. let me know there are any suugesstion required.
donavalli
(Ravi Teja Donavalli)
April 4, 2025, 5:55pm
17
Hi @gogubapu ,
This transform is writing NO to all the users with and without end date.
Thank you
gogubapu
(bapu gogu)
April 7, 2025, 9:26am
18
you may modify source name and attribute name:
{
"name": "End Date 30 Days Out",
"type": "static",
"attributes": {
"UserEndDateCompareValue": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "static",
"attributes": {
"firstDate": {
"attributes": {
"expression": "+30d",
"input": {
"attributes": {
"input": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "JP Test Source",
"attributeName": "endDate"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "01/01/1111"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"roundUp": true
},
"type": "dateMath"
},
"value": "$firstDate"
}
},
"secondDate": "now",
"operator": "gte",
"positiveCondition": "Yes",
"negativeCondition": "No"
}
},
"value":"#if($userEndDateCheck == null)Yes#elseif($UserEndDateCompareValue == 'Yes' && $userEndDateCheck != null)Yes#else No #end",
"userEndDateCheck": {
"attributes": {
"sourceName": "JP Test Source",
"attributeName": "endDate"
},
"type": "accountAttribute"
}
},
"internal": false
}
gogubapu
(bapu gogu)
April 8, 2025, 5:56pm
19
Find below modified transform
{
"name": "End Date 30 Days Out",
"type": "static",
"attributes": {
"UserEndDateCompareValue": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "static",
"attributes": {
"firstDate": {
"attributes": {
"expression": "+30d",
"input": {
"attributes": {
"input": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "JP Test Source",
"attributeName": "endDate"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "01/01/1111"
},
"type": "static"
}
]
},
"type": "firstValid"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
},
"roundUp": true
},
"type": "dateMath"
},
"value": "$firstDate"
}
},
"secondDate": "now",
"operator": "gte",
"positiveCondition": "Yes",
"negativeCondition": "No"
}
},
"value":"#if($userEndDateCheck == 'none' )Yes#elseif($UserEndDateCompareValue == 'Yes')Yes#else No #end",
"userEndDateCheck": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "JP Test Source",
"attributeName": "endDate"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "none"
},
"type": "static"
}
]
},
"type": "firstValid"
}
},
"internal": false
}
donavalli
(Ravi Teja Donavalli)
April 8, 2025, 7:35pm
20
Hi @gogubapu ,
This is working as expected, appreciate for all your help.
Thank you