[SalesForce] How to check whether a permission set is already assigned to a user from a flow

I am a beginner in process builder and flows
I have a requirement to delete a permission set from a user through a process builder and a flow.
I have the user ID and also have the permission set ID that need to be deleted.
I have created a flow to delete the permissionset assignment record and invoking it through a process builder flow based on user record create/update based on the above two variables. However the flow fails if the permission set is not already assigned to the user.
May I know how can I check whether a permission set is assigned to a user from a flow?

Best Answer

Before deleting, you may want to use RecordLookup in Flow to check if the permission set is being assign to the user.This Flow can be invoked from Process Builder.In Process builder you can set the user id as input.

You can choose PermissionSetAssignment Lookup and look for the AssigneeId. Put the outcome in Decision, if it 's not exist do not delete.

The overall idea is something like this:

enter image description here

Hope it helps.