Unable to fetch the Delegatee Name in Email Template

Hello Sailors,

I am using the pre-delegation rule in Targeted certification. Delegation working successfully but when i try to give delegateeName on email template to Address as Dear $delegateeName, not able to fetch the value.

Work Around - I have create a results map in pre-delegation rule like below

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Target-PreDelegation" type="CertificationPreDelegation">
  <Description>A pre-delegation rule that is run on every CertificationEntity when the certification is generated in order to cause some entities to be pre-delegated.  As an example, a manager certification could pre-delegate the certification responsibility to each employee that reports to the manager.  This would allow each subordinate to first determine what they need access to, then allow the manager to review their decision.</Description>
  <Signature returnType="Map">
    <Inputs>
      <Argument name="log" type="org.apache.commons.logging.Log">
        <Description>
          The log object associated with the SailPointContext.
        </Description>
      </Argument>
      <Argument name="context" type="sailpoint.api.SailPointContext">
        <Description>
          A sailpoint.api.SailPointContext object that can be used to query the database if necessary.
        </Description>
      </Argument>
      <Argument name="certification">
        <Description>
          The sailpoint.object.Certification being created.
        </Description>
      </Argument>
      <Argument name="entity">
        <Description>
          The sailpoint.object.CertificationEntity to possibly pre-delegate.
        </Description>
      </Argument>
      <Argument name="certContext">
        <Description>
          The sailpoint.api.CertificationContext generating this certification.
        </Description>
      </Argument>
      <Argument name="state">
        <Description>
          A Map containing state information.
        </Description>
      </Argument>
    </Inputs>
    <Returns>
      <Argument name="recipientName">
        <Description>
          The name of the Identity that should certify this entity.  Either
          this or 'recipient' should be non-null if pre-delegation should be
          performed.
        </Description>
      </Argument>
      <Argument name="CustomMap" type="Map"/>
      <Argument name="recipient">
        <Description>
          The Identity that should certify this entity.  Either this or
          'recipientName' should be non-null if pre-delegation should be
          performed.
        </Description>
      </Argument>
      <Argument name="description">
        <Description>
          Optional description to set on the delegation WorkItem.  If null, a
          default description of 'Certify [entity name]' is used.
        </Description>
      </Argument>
      <Argument name="comments">
        <Description>
          Optional comments to set on the delegation WorkItems.
        </Description>
      </Argument>
      <Argument name="reassign">
        <Description>
          Optional boolean to specify to reassign rather than delegate.
        </Description>
      </Argument>
      <Argument name="certificationName">
        <Description>
          Optional String to specify the name for the reassignment certification
          if creating a new certification for reassignment.  This is ignored for
          delegations.
        </Description>
      </Argument>
    </Returns>
  </Signature>
  <Source>
  import sailpoint.object.*;
  import sailpoint.object.Identity;

  Map results = new HashMap();
  String newCertifier = "AdamK"; 


  String theCertifiee = entity.getIdentity();
  Identity identity = context.getObjectByName(Identity.class, theCertifiee);
  log.error("Identity => "+identity.getName());

  Identity manager = identity.getManager();
  log.error("Pre-Delegation ManagerName => "+manager.getName());

  // 
  if(manager != null &amp;&amp; manager.getName().equals("RamsyG")){  
    // Assigning to newCertifier as AdamK -> 

    Identity id = context.getObjectByName(Identity.class, newCertifier);
    results.put("recipient", id);
    results.put("recipientName", newCertifier);

    results.put("comments", "Please validate all the accesses");
  }

  Map CustomMap = new HashMap();
  CustomMap.put("delegateeName", newCertifier);
  results.put("CustomMap", CustomMap);

  log.error("results => "+results);
  return results;

  </Source>
</Rule>

In OOTB EmailTempate => Delegation I am trying to fetch the delegateeName from OOTB since I am returning map as results.

Below for Email template =>

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE EmailTemplate PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<EmailTemplate created="1650524520470" id="0a281e84804a1d2281804aed80160149" modified="1740412397456" name="Delegation">
  <Body>

    Dear $CustomMap.delegateeName,      
    Dear $recipient,      
    Dear $recipientName,      
    Dear $delegateeName,     

  </Body>
  <Description>
    Email Template for notifying work item owners of new delegations.
  </Description>
  <Signature>
    <Inputs>
      <Argument name="recipient"/>
      <Argument name="workItem" type="WorkItem">
        <Description>The WorkItem created for this delegation.</Description>
      </Argument>
      <Argument name="workItemName" type="string">
        <Description>The description property (also the name property) of the delegation WorkItem.</Description>
      </Argument>
      <Argument name="comments" type="string">
        <Description>Comments from the delegator.</Description>
      </Argument>
      <Argument name="certification" type="Certification">
        <Description>The Certification object containing the delegated item.</Description>
      </Argument>
      <Argument name="requesterName" type="string">
        <Description>The display name of the Identity that requested the delegation.</Description>
      </Argument>
      <Argument name="delegateeName" type="string">
        <Description>The display name of the Identity that finished the delegation.</Description>
      </Argument>
      <Argument name="CustomMap" type="Map">
        <Description>The display name of the Identity that finished the delegation.</Description>
      </Argument>
    </Inputs>
  </Signature>
  <Subject>New delegation request from $!requesterName to $!workItemName</Subject>
</EmailTemplate>

And also Trying to get it from the CustomMap as referenced like $delegateeName. But couldn’t work.

Any suggestions highly appreciated.

Hi @chintjub,
We have the same requirement as well. Could anyone provide a suggestion?
Thanks,

Hi @chintjub ,

It looks like you don’t have recipientName name in the Inputs, please try to add it and test.

<Argument name="recipientName" type="string">
        <Description>Name of the Recipient.</Description>
</Argument>

Or you can try one way if that is also not working, like use recipient value only since it is Identity object, you can get from Identity Object, use VTL language bit, you will get it.

i have added the argument but no luck,

The issue you’re running into is pretty common when dealing with custom variables inside email templates. Even though you are adding delegateeName to the CustomMap, the default email templates sometimes don’t automatically recognize nested custom values without extra configuration.

One thing you might try is double-checking if the context properly passes the CustomMap to the email template. Some integrations between SailPoint objects and templates require explicitly pulling the custom map values out in the template itself — you might need to reference it a little differently, like $!CustomMap.delegateeName.