Salary Component Condition: Error evaluating 'date_diff' and 'employee' object attributes

I am trying to configure a Salary Component in Frappe HRMS that only applies if an employee has been with the company for more than 60 days.

However, I am consistently hitting evaluation errors when testing this on a Salary Slip. I have tried several variations in the “Condition” field, but each fails for different reasons.

The Logic I Need:
If (Payroll Date - Employee Joining Date) > 60 days, then apply component.

Errors encountered so far:

  1. Using date_diff(payroll_date, employee.date_of_joining) > 60 returns: “name ‘date_diff’ is not defined” or “name ‘payroll_date’ is not defined”.

  2. Using (payroll_date - employee.date_of_joining).days > 60 returns: “‘str’ object has no attribute ‘date_of_joining’”, suggesting the employee variable is being treated as a string (ID) rather than a Document object.

Question:
What is the correct, allowlisted syntax to calculate the difference between the Salary Slip date and the Employee’s Joining Date within the Salary Component condition field for this version?

You don’t need to specify the employee doctype. Do you see the autocomplete options?

Does the following work?

date_of_joining - start_date

Also, I don’t believe conditions works with formula. If you need to calculate the component via a formula, put all of your logic (including if statements for condition matching) in the formula field.

How can I set up an MPF_ER pay item that shows up on the payslip but doesn’t change the final payout amount? I also need the calculation to be 5% of the salary, but it should never go above $1,500. Thank you so much!!