code: public static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException {
  
          if (CmsUUID.isValidUUID(returnCode)) {
              try {
                  CmsResource pageRes = cms.readResource(new CmsUUID(returnCode), CmsResourceFilter.IGNORE_EXPIRATION);
                  return new CmsReturnLinkInfo(
                      OpenCms.getLinkManager().substituteLink(cms, pageRes),
                      CmsReturnLinkInfo.Status.ok);
              } catch (CmsVfsResourceNotFoundException e) {
                  LOG.debug(e.getLocalizedMessage(), e);
                  return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound);
              }
          } else {
              int colonIndex = returnCode.indexOf(':');
              if (colonIndex >= 0) {
                  String before = returnCode.substring(0, colonIndex);
                  String after = returnCode.substring(colonIndex + 1);
  
                  if (CmsUUID.isValidUUID(before) && CmsUUID.isValidUUID(after)) {
                      try {
                          CmsUUID pageId = new CmsUUID(before);
                          CmsUUID detailId = new CmsUUID(after);
                          CmsResource pageRes = cms.readResource(pageId);
                          CmsResource folder = pageRes.isFolder()
                          ? pageRes
                          : cms.readParentFolder(pageRes.getStructureId());
                          String pageLink = OpenCms.getLinkManager().substituteLink(cms, folder);
                          CmsResource detailRes = cms.readResource(detailId);
                          String detailName = cms.getDetailName(
                              detailRes,
                              cms.getRequestContext().getLocale(),
                              OpenCms.getLocaleManager().getDefaultLocales());
                          String link = CmsFileUtil.removeTrailingSeparator(pageLink) + "/" + detailName;
                          return new CmsReturnLinkInfo(link, CmsReturnLinkInfo.Status.ok);
                      } catch (CmsVfsResourceNotFoundException e) {
                          LOG.debug(e.getLocalizedMessage(), e);
                          return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound);
  
                      }
                  }
              }
              throw new IllegalArgumentException("return code has wrong format");
          }
      }
docs: Implementation method for getting the link for a given return code.<p>
  
  @param cms the CMS context
  @param returnCode the return code
  @return the link for the return code
  
  @throws CmsException if something goes wrong