87 views

Description

When there are data policies with mandatory fields on the sys_user table, the "Create a User" step fails, unable to create the user since the step does not support setting fields.

Steps to Reproduce

1. Navigate to System Policy > Rules > Data Policies and create a new data policy.
2. Specify the table to be 'sys_user' and submit.
3. Create a Data Policy rule with any field [for example employee_number].
4. Set the following: "Mandatory" is "True" and "Read-only" is "Leave Alone".
5. Submit the Data Policy rule.
6. Navigate to Automated Test Framework > Tests.
7. Create a new test.
8. Add test step "Create a User"
9. Fill in the fields as follows: "first name" is "peter" and "last name" "mark". Notice there is no place to set the mandatory field.
10. Save the step.
11. Run the test, navigate to the test result record.

Notice the failure message "Failed to create user 'peter mark'". Notice the errors in the test logs:
Creating new user with UserID a7d4e2fa1bb3c0103f5599f6bc4bcb14: mark, peter
Background message, type:error, message: Data Policy Exception:
The following fields are mandatory: employee number

It is not possible to set mandatory field values in the "Create a User" step.

Workaround

This problem is under review and targeted to be fixed in a future release. To receive notifications when more information becomes available, subscribe to this Known Error article by clicking the Subscribe button at the top right of this form.

Workaround #1: Use Record Insert Steps

  1. Navigate to Automated Test Framework > Tests. Open the test record with the Create a User step
  2. Record Insert: User record
    1. Click Add Test Step > Server > Record Insert > Next
    2. Set the fields as follows: Table to User [sys_user], First Name, Last Name, and any fields required by the UI policy
    3. Click Submit
  3. Record Insert: Role record (f roles are required)
    1. Click Add Test Step > Server > Record Insert > Next
    2. Set Table to User Role [sys_user_has_role]
    3. Use the mapping icon to set the User field to the record created in Step 2
    4. Set the Role field to the desired role
    5. Click Submit
    6. Repeat a-e for additional roles required
  4. Record Insert: Group record (f groups are required)
    1. Click Add Test Step > Server > record Insert > Next
    2. Set Table to User Group [sys_user_grmember]
    3. Use the mapping icon to set the User field to the record created in Step 2
    4. Set the Group field to the desired group
    5. Click Submit
    6. Repeat a-e for additional groups required
  5. Impersonate (if impersonating the user)
    1. Click Add Test Step > Server > Impersonate > Next
    2. Use the mapping icon to set the User field to the record created in Step 2
    3. Click Submit
  6. Run the test

Workaround #2: Convert UI Policy to Data Policy

  1. Navigate to System UI > UI Policies. Open the UI Policy on the User table
  2. Click the 'Convert to UI Policy' UI action
  3. Navigate to Automated Test Framework > Tests and run the test

Related Problem: PRB1394799

Seen In

SR - IRM - Audit Management - New York 2019 Q3
SR - IRM - GRC Profiles - Madrid 2019 Q2
SR - IRM - Policy and Compliance - Madrid 2019 Q2
SR - IRM - Risk Management - New York 2019 Q3
SR - ITOM - Discovery and Service Mapping - 201908
SR - Security - Integration Framework - Madrid 2019 Q2
SR - Security - Support Common - Madrid 2019 Q2
SR - Security - Support Orchestration - Madrid 2019 Q2
SR - SIR - Security Incident Response - Madrid 2019 Q2
SR - SIR - Splunk Sighting Search Integration - Madrid 2019 Q1
SR - SIR - Store SecOps Setup Assistant - Madrid 2019 Q2
SR - SIR - Store Threat Core - Madrid 2019 Q2
SR - SIR - Store Trusted Security Circles Client - New York 2019 Q3
SR - VR - Qualys - New York 2019 Q3
SR - VR - Vulnerability Response - New York 2019 Q3

Intended Fix Version

Quebec

Fixed In

Orlando Patch 9
Paris Patch 3

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-10-07 15:20:04
Published:2020-07-14