Im receiving the below error in IDN for my lcs attribute. I cant seem to figure out why the error is generating. Im attempting to add 30days to the term date and compare to the system date and return true or false
There was an exception while calculating the value for this attribute. Error rendering template: #if ($lsState == ‘inactive’ && $30DayPastEndDateCheck == ‘true’) terminated #elseif ($lsState == ‘rehire’) prehire #else $lsState #end
Close
{
"name": "LCS Status",
"type": "static",
"attributes": {
"lsState": {
"type": "accountAttribute",
"attributes": {
"sourceName": "Workday (R1)",
"attributeName": "LifecycleStatus__c"
}
},
"30DayPastEndDateCheck": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "dateMath",
"attributes": {
"expression": "+30d",
"input": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"sourceName": "Workday",
"attributeName": "LAST_DAY_OF_WORK"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
}
}
}
},
"secondDate": {
"type": "dateMath",
"attributes": {
"expression": "now",
"outputFormat": "ISO8601"
}
},
"operator": "lte",
"positiveCondition": "true",
"negativeCondition": "false"
}
},
"value": "#if($lsState == 'inactive' && $30DayPastEndDateCheck == 'true') terminated #elseif($lsState == 'rehire') prehire #else $lsState #end"
}
}
schattopadhy
(SHANTANU CHATTOPADHYAY)
April 2, 2024, 5:57am
2
@jhayes9090 try to check if these two values are coming up or not looks the the value lsState and date one is not able to generate,try testing them individually if you get any value and see
jesvin90
(Jesvin Joseph)
April 2, 2024, 7:36am
4
Hi @jhayes9090 ,
Can you try this in the velocity template and see if it works:
"value": "#if($lsState == 'inactive' && $30DayPastEndDateCheck == 'true')terminated#elseif($lsState == 'rehire')prehire#{else}$lsState#end"
If not, I would try using the below values in the velocity template to see if it shows the expected values :
“value”:$lsState
“value”:$30DayPastEndDateCheck
schattopadhy
(SHANTANU CHATTOPADHYAY)
April 2, 2024, 12:04pm
6
@jhayes9090 please try this code and let us know update it as per your requirement
"id": "103870c8-a87f-4c1e-9965-00ca5c580660",
"name": "LCS Status",
"type": "static",
"attributes": {
"lsState": {
"attributes": {
"values": [
{
"attributes": {
"value": "inactive"
},
"type": "static"
},
""
]
},
"type": "firstValid"
},
"value": "#if($lsState=='inactive' && $checkdate == 'true')terminated#elseif($lsState == 'rehire')prehire#{else}$checkdate#{end}",
"checkdate": {
"attributes": {
"secondDate": {
"attributes": {
"expression": "now",
"roundUp": false
},
"type": "dateMath"
},
"negativeCondition": {
"attributes": {
"value": "true"
},
"type": "static"
},
"operator": "gte",
"positiveCondition": {
"attributes": {
"value": "false"
},
"type": "static"
},
"firstDate": {
"type": "dateMath",
"attributes": {
"expression": "now+30d",
"input": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "accountAttribute",
"attributes": {
"sourceName": "Hr Non Emp Hari",
"attributeName": "endDate"
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
}
}
}
}
},
"type": "dateCompare"
}
},
"internal": false
}
type or paste code here
try this…
{
"name": "LCS Status",
"type": "static",
"attributes": {
"value": "#if($lsState == 'inactive' && $30DayPastEndDateCheck == 'true') terminated #elseif($lsState == 'rehire') prehire #else $lsState #end",
"lsState": {
"type": "accountAttribute",
"attributes": {
"sourceName": "Workday (R1)",
"attributeName": "LifecycleStatus__c"
}
},
"30DayPastEndDateCheck": {
"type": "dateCompare",
"attributes": {
"firstDate": {
"type": "dateFormat",
"attributes": {
"input": {
"type": "firstValid",
"attributes": {
"values": [
{
"type": "accountAttribute",
"attributes": {
"sourceName": "Workday",
"attributeName": "LAST_DAY_OF_WORK"
}
},
"12/31/2124"
]
}
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
}
},
"secondDate": {
"type": "dateFormat",
"attributes": {
"input":{
"type": "dateMath",
"attributes": {
"expression": "now-30d/d",
"roundUp": false
}
},
"inputFormat": "yyyy-MM-dd'T'HH:mm",
"outputFormat": "ISO8601"
}
},
"operator": "lte",
"positiveCondition": "true",
"negativeCondition": "false"
}
}
}
}
1 Like
Jhayes90
(Jhavel Hayes)
April 2, 2024, 2:21pm
8
Hi Nithesh,
I tried your block and I still receive same error. I did a test and set value to both lsState and 30DayPastEndDateCheck. I receive the value for lsState but 30DayPastEndDateCheck prints out “$30DayPastEndDateCheck”. So it doesnt render the logic it encapsulates
Apparently using a number in the beginning of a variable does not work with Velocity templates. Change 30DayPastEndDateCheck
to Check30DayPastEndDate
2 Likes
Good to know… Just a note to add here. In your original transform you had used dateMath
directly for firstDate
and secondDate
. But these 2 fields need inputs in ISO8601 format and dateMath
does not have output in this format.
Hence, you need to wrap
dateMath
with a
dateFormat
tranform before using it in
dateCompare
system
(system)
Closed
June 1, 2024, 3:09pm
12
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.