Cloud Rule Checking Errors: [RegExRuleValidator(602)]

Hi,
I’m running a rule I’ve written through the "saas-rule-validator"and I’m getting this response which doesn’t seem to make sense:
Error message:

[RegExRuleValidator(602)] <Rule> tag: Rule name 'Rule - BeforeProvisioning - OU moves' defined within the Rule tag does not match name defined in the file name of: OU moves

Code =

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="Rule - BeforeProvisioning - OU moves" type="BeforeProvisioning">
  <Description>Moves user to correct OU based upon Identity attributes</Description>
  <Source><![CDATA[

File name =

The error message is suggesting that the rule name != the file name (which it doesn’t according to the error message) but does if you compare the values. I’m using the following command to test the rule:

sp-rv -f C:\Users\myname\sailpoint-saas-rule-validator-3.0.41

If seeing the whole code helps:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="Rule - BeforeProvisioning - OU moves" type="BeforeProvisioning">
  <Description>Moves user to correct OU based upon Identity attributes</Description>
  <Source><![CDATA[

import sailpoint.object.Identity;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan.Operation;

List accountRequests = plan.getAccountRequests();

if (accountRequests != null) {
    for (AccountRequest accountRequest: accountRequests) {
        AccountRequest.Operation op = accountRequest.getOperation();
        if(op == null) continue;
        String nativeIdentity = accountRequest.getNativeIdentity();
        Identity identity = plan.getIdentity();
        String activeOU = null;
        String actualOU = null;
        if(identity != null){
            activeOU = identity.getAttribute("activeParentOu"); //Where they should be
            actualOU = identity.getAttribute("actualParentOu"); //Where they are
        }
        
        if(actualOU != null && activeOU != null activeOU != actualOU){ //If the account is not in the correct OU, move them
            accountRequest.add(new AttributeRequest("AC_NewParent", ProvisioningPlan.Operation.Set, activeOU));
        }
    }
}

  ]]></Source>
</Rule>

As I’m also getting this error message:

  Line 24 - [LintProcessor(0)] Could not parse line, check to ensure line is syntatically correct. Error: Encountered "activeOU" at line 24, column 49.  Error occured between lines 9 and 24

Thanks,
Phil

1 Like

This process is goofy, but the name of your file should be:
Rule - BeforeProvisioning - OU moves

and then the name attribute in the rule should just be:
OU moves

Documented here: Cloud Executed Rules | SailPoint Developer Community

2 Likes

Hi @phil_awlings ,
I noticed that there is a missing && in this line. It should be:
if (actualOU != null && activeOU != null && activeOU != actualOU) {

4 Likes

Hi @phil_awlings , The error also indicates incorrect assignment for the String

As I’m also getting this error message:

  Line 24 - [LintProcessor(0)] Could not parse line, check to ensure line is syntatically correct. Error: Encountered "activeOU" at line 24, column 49.  Error occured between lines 9 and 24
    String activeOU = null;
    String actualOU = null;

It should be

    String activeOU = "";
    String actualOU = "";

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