Hello,
I need help writing a plugin that updates a boolean field of the target entity, if a value of the target entity exists in the records of another entity.
Specifically, the target entity is 'Case' and the attribute I am interested in is Serial Number (which is a lookup field). So, I need to check if Serial Number already exists in another entity ('Warranties'), and if so, if it has not expired (ending date > today). Plugin will get triggered when a Case is created and if all criteria are met, it will update a boolean field to 'true'.
Should I get service.retrieve to get all warranties records and check if value exists or should I use a foreach on the Warranties Entity? I don't have any experience on writing plugins, so any help would be much appreciated.