Question
6
Replies
1041
Views
Posted: March 19, 2018
Last activity: March 27, 2018
Closed
Function working when running an activity, but not with an agent
Hello.
I'm trying to use the following in an activity:
@DateTime.addToDateYM(Param.CurrentDate,"0","-6","0","0","0","0")
(with Param.CurrentDate as a String or DateTime parameter, the problem is the same with both). The aim is to substract 6 months to the current date.
My activity is doing well when I run it but if an agent does, I keep having this message in the SMA:
** ** 1228138309§addToDateYM§PegaEL-InvalidExpressionNo candidates found [possible function name, ruleset/version or number of parameter problem] for Rule-Utility-Function in ruleset list expected since isEditing is false ruleset = null library = DateTime functionName = addToDateYM parameters =[ Item: Param.CurrentDate Pega type = datetime Java data type = BigDecimal, Item: "0" Pega type = text Java data type = String, Item: "-6" Pega type = text Java data type = String, Item: "0" Pega type = text Java data type = String, Item: "0" Pega type = text Java data type = String, Item: "0" Pega type = text Java data type = String, Item: "0" Pega type = text Java data type = String]@DateTime.addToDateYM(Param.CurrentDate,"0","-6","0","0","0","0")
It seems that the agent doesn't find a candidate matching the function with its current parameters (the first one being the unrecognized one) but I tried everything and nothing work: @CurrentDateTime(), @today(), BigDecimalString or DateTime parameter, etc.
Any idea? I would like to avoid writting a java step just for that...
Hi @ThomasL8,
Thanks for posting on PSC.
I have verified your use-case in-house. I am not sure what exactly could be the root cause of the problem you're facing.
Also, I didn't understand the second part of your post "It seems that the agent doesn't find a candidate matching the function with its current parameters (the first one being the unrecognized one) but I tried everything and nothing work: @CurrentDateTime(), @today(), BigDecimalString or DateTime parameter, etc."
If your requirement is to subtract 6 days from the passed date.
Try using "@addToDate(Param.CurrentDate,-6,0,0,0)" in the activity directly, if you're setting it in a property using "Property-Set". Or else, you could use it with reference to Library "@DateTime.addToDate(Param.CurrentDate,-6,0,0,0)".
Also, if you're facing any issue reference of "Param.CurrentDate". Instead directly passing the value(ideally it should work.), you can set the Param.CurrentDate in a local property in a step before you're referring this function and then refer it directly to your function. It would help in isolating the root cause.
Hope it helps, kindly notify if it does by marking this post as answered for larger Pega audience and tracking purposes.
Regards,
Asif