Filter relationship grid rows from code

Hi Experts,

I have the requirement that, as per the form property value the relationship content should be shown. I have tried many things but it didnt helped.

E.g I have the form property as dept_name and it has value like "Finance" and "Delivery", according to the value of this property, relationship grid should automatically filter the content(rows).

In my relationship i have both Finance and Delivery values, If logged in user is from Finance then he should be able to see only Finance related rows and delivery user can see only for Delivery dept. records.

Anybody have idea on this? Also is there any way that we can apply the fixed filter in relationship grid on particular property?