code: public static Credential getCredential(final RequestContext context) {
          val cFromRequest = (Credential) context.getRequestScope().get(PARAMETER_CREDENTIAL);
          val cFromFlow = (Credential) context.getFlowScope().get(PARAMETER_CREDENTIAL);
          val cFromConversation = (Credential) context.getConversationScope().get(PARAMETER_CREDENTIAL);
  
          var credential = cFromRequest;
          if (credential == null || StringUtils.isBlank(credential.getId())) {
              credential = cFromFlow;
          }
          if (credential == null || StringUtils.isBlank(credential.getId())) {
              credential = cFromConversation;
              if (credential != null && !StringUtils.isBlank(credential.getId())) {
                  context.getFlowScope().put(PARAMETER_CREDENTIAL, credential);
              }
          }
  
          if (credential == null) {
              val session = context.getFlowExecutionContext().getActiveSession();
              credential = session.getScope().get(PARAMETER_CREDENTIAL, Credential.class);
          }
          if (credential != null && StringUtils.isBlank(credential.getId())) {
              return null;
          }
          return credential;
      }
docs: Gets credential from the context.
  
  @param context the context
  @return the credential, or null if it cant be found in the context or if it has no id.