Help with getting entitlement name from source using entitlement ID in before provisioning rule for Service Desk Integration

Hello,

My team is still relatively new with SailPoint so apologies if I am not asking this question properly. We are trying to get our ServiceNow Service Desk Integration updated so that it puts entitlement names in the tickets instead of just putting entitlement IDs. I put together some code for a Before Provisioning rule, but I am having trouble finding documentation/posts on how to get an entitlement’s name from a source using its ID. Is there a way in the rule code to retrieve the name of the entitlement using the ID? Included the rule code below incase that is helpful.

import sailpoint.object.*;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AccountRequest.Operation;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.Operation;
import sailpoint.rule.ManagedAttributeDetails
import java.util.List;
import java.util.HashSet;

Schema schema = application.getAccountSchema();
List attributes = schema.getAttributes();
HashSet<String> entitlementAttributes = new HashSet<String>();
for ( AttributeDefinition attributeDefinition : attributes ) {
	if ( attributeDefinition.isEntitlement() ) {
		entitlementAttributes.add( attributeDefinition.getName() )
	}
}

for ( AccountRequest accountRequest : plan.getAccountRequests() ) {   
	for ( AttributeRequest attributeRequest : accountRequest.getAttributeRequests() ) {
		String name = attributeRequest.getName()
		if ( !entitlementAttributes.contains(name) ) { continue; }
		
		// Load all the entitlement IDs into a list
		List entitlementIds = new ArrayList();
		Object valueObj = attributeRequest.getValue();
		if (valueObj instanceof String) {
			entitlementIds.add((String)valueObj)
		}
		else if (valueObj instanceof List) {
			for (String entitlementId : valueObj) {
				entitlementIds.add((String)entitlementId);
			}
		}
		
		// Get entitlement names
		List entitlementNames = new ArrayList()
		for (String entitlementId : entitlementIds) {
			// Get entitlement name and add it to entitlementNames
		}
		
		attributeRequest.setValue(entitlementNames)	
	}
}