The workflow custom function called P2K_CF_ECR_EXISTS reads through the Contact Role Contact Types and returns TRUE if it finds a match to the value populated to the User Calc global CONTACT_TYPE or FALSE if it does not.

Setup:
In the IMUC screen create the Global called CONTACT_TYPE  as a type of “Char”.
 
Sample Work Flow User Calc:
A sample workflow usercalc in its simplest form (see example in screenshot) would be to set the CONTACT_TYPE global to ‘03’ (Emergency Contact) then call the P2K_CF_ECR_EXISTS custom function.
If the triggering contact record has a contact role with “Emergency Contact” set them the custom function will return TRUE and we proceed to the next line otherwise we jump to the end.
In our sample the result of getting TRUE returned has the ECT.SECURITY_LEVEL being set to ‘01’ which represents “Emergency”.
In a real world scenario you would add conditions to the usercalc to check whether the Security Level already had a value.