Rule to get a manager for Coupa based on the level by iterating till the manager's level is 10 and should not escalate to level 15 (CEO/VP), it should be stopped to level 14

Coupa Manager Rule

Rule to get a manager for Coupa based on the level by iterating till the manager’s level is 10 and should not escalate to level 15 (CEO/VP), it should be stopped to level 14.

what change we can do in here ?

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="GetCoupaManagerRuleUpdated" type="IdentityAttribute">
  <Description>Rule to get a manager for Coupa based on the level by iterating till the manager's level is 10 or more</Description>
  <Source><![CDATA[

	import sailpoint.object.*;

	Identity userIdentity = identity; 
	String noManagerSet = ""; 
	String managerLevel = null;
	String managerEmail = null;

	for (int i = 1; i <= 10; ++i) {
		if (userIdentity != null) {
			Identity managerIdentity = userIdentity.getManager(); 
			
			if(managerIdentity != null)
			{
				if (managerIdentity.getAttribute("level") != null)
				{
					managerLevel = (String) managerIdentity.getAttribute("level");
					int managerLevelValue = Integer.parseInt(managerLevel);
				 
					if (managerLevelValue > 9){
						 if (managerIdentity.getAttribute("email") != null)
								managerEmail = (String) managerIdentity.getAttribute("email");
						  break;
					}
					else 
						userIdentity = managerIdentity;
				}
				else
					userIdentity = managerIdentity;
			}
			else
				break;
		}
		else
			break;
	}
	return managerEmail;



  ]]></Source>
</Rule>

@sup3rmark @jesvin90 @sharvari

Try this code

import sailpoint.object.*;
	Identity userIdentity = identity;
    Identity managerIdentity = null;
	int managerLevel = 0;
	String managerEmail = null;

	for (int i = 0; managerLevel != 15; i++) {
		if (userIdentity != null) {
			managerIdentity = userIdentity.getManager(); 
			
			if(managerIdentity != null) {
				if (managerIdentity.getAttribute("level") != null) {
					managerLevel = Integer.parseInt(managerIdentity.getAttribute("level"));
				 
					if (managerLevel > 9 && managerLevel < 15){
						 if (managerIdentity.getAttribute("email") != null) {
								managerEmail = (String) managerIdentity.getAttribute("email");
								break;
						  }
					} else 
						userIdentity = managerIdentity;
				}
				else
					userIdentity = managerIdentity;
			}
			else
				break;
		} else
			break;
	}
	return managerEmail;
1 Like

Thank you @KRM7 really appreciate it.
before going ahead had questions

  1. As this is a cloud rule how can i get this reviewed & deployed without ES,
    is there a way to at least let me deploy a cloud rule by self using API in lower Env, if yes could you point out which endpoint.
  2. can this also be handled by transforms, can a transform handles this operations send over across to coupa application and manage manager email escalation based on the logic defined ?

No, SailPoint only can deploy cloud Rule

I don’t think any OOTB Transform can support your requirement, you can use Static Transform with Apache Velocity script, it is not that simple but doable.

Thanks
Krish

tried this and am facing this error

Hi @osmanmohammed

Please make sure that when you run the rule validator, -file is something like

sp-rv -f "Rule - RuleType - YourFileName.xml"

I guess in your case it should be

sp-rv -f "Rule - IdentityAttribute - coupa_production_updated_rule.xml"

it says file does not exist

step 1) chmod +x sp-rv
step 2) 
![image|690x46](upload://A8s9SVM4EGg0gq03NVAJ2mXX4iC.png)
output


![Screenshot 2024-07-02 at 10.56.56 AM|690x396](upload://4Bmw2kIgM6r2gmiVebyuFc31izp.jpeg)

Could you please share those output images? I think they weren’t uploaded in this post.

./sp-rv -f “Rule - IdentityAttribute - coupa_production_updated_cloud_rule.xml” -r

Seems like the xml file should be saved in the name

Rule - IdentityAttribute - coupa_production_updated_rule.xml

I assume that this is given in the xml file,

<Rule name="coupa_production_updated_cloud_rule" type="IdentityAttribute">

So this takes the rule name not the file name

sp-rv -f "Rule - RuleType - YourRuleName.xml"

sp-rv -f "Rule - IdentityAttribute - coupa_production_updated_rule.xml"

nope, rule name →
<Rule name="GetCoupaManagerRuleUpdated" type="IdentityAttribute">
[/quote]

and file name → coupa_production_updated_cloud_rule.xml

it should not populate approvers whose manager level 15

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.