Hi Vignesh
P_CAN_PENALTY is a custom field unrelated to the perpetual flag. There is a system standard check box that indicates whether an agreement is perpetual or whether it has an expiration date. I just do not know how to bring check and validate whether the perpetual flag is set.
The error message is a fairly generic message "You cannot set an expiration date for a perpetual contract. If you want the contract to expire on a specific date, deselect Perpetual Terms and enter the expiration date." and it occurs because the script is attempting to default an expiration date based on the effective date of the agreement.
Thank you
Christopher