Catalog form should not allow for creation of duplicates/Collisions

Community Alums
Not applicable

Hi,

I have a story assigned to me. The requirements are as below. I have completed all except one. I don't know how to do it. Kindly help.

 

-The Destination target field should be placed under Service and only populate when "Web" is selected on the Access Level Entitlement field.
-When "Network" is selected on the Access Level Entitlement field, The Destination target field should be hidden.
-Rename the Network field next to Access Level Entitlement to "Network Access by" and should only be available when "Network" is selected on the Access Level Entitlement field.
-The Firewall Rule Application Ownership field should be moved down to Risk and Governance.
-Risk & Governance should not have a space between & and Governance.
-Firewall Application Ownership should be an App Code and not manager/user.
-"Yes" should be under "No" on the Reverse Proxy field.
-Catalog form should not allow for creation of duplicates/Collisions
-On the Network Access by field only the selected option should be displayed i.e. if "Layer7 Application Firewall" is selected. Destination Protocol and Destination Service Port should be hidden.

 

 

The name of the catalog item is Service Catalog Request New - Manage Firewall Egress Rules by Application Service

 

What I understand by the requirement is , it should not allow the creation of duplicate records based on how the records are identified uniquely.

 

How would I know which field is unique in a table? And, How would I restrict the data not to be duplicate.

 

Regards

Suman P.

 

1 ACCEPTED SOLUTION

Hi @Community Alums ,

The below is just sample script which checks new or existing record based on u_application_code

var checkRecord = new GlideRecord('cmdb_ci_service');
checkRecord.addQuery('u_application_code', 'SAP Payroll'); //If this is reference field then pass sysID(update as per your setup)
checkRecord.query();
if (checkRecord.next()) { //if record exists update fields
//Add more fields
    checkRecord.setValue('operational_status', '1');
    checkRecord.update();

}
else{
//create new record
	checkRecord.initialize();
       //Add more fields
	checkRecord.setValue('name', 'SN Community');
	checkRecord.setValue('used_for', 'Production');
	checkRecord.insert();

}

 

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

View solution in original post

9 REPLIES 9

Satishkumar B
Giga Sage
Giga Sage

Hi @Community Alums 
check if this helps:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0749064

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand. 



Community Alums
Not applicable

Hi @Satishkumar B

The question is about prevention of creation of duplicate records in a table and not duplicate requests.

Regards

Suman P.

Satishkumar B
Giga Sage
Giga Sage

Hi @Community Alums 

  • Identify Unique Fields: Check the table schema and business rules to determine which fields uniquely identify records.

  • Prevent Duplicates: Use a Business Rule to enforce uniqueness based on identified fields.

  • Field Visibility: Configure UI Policies to show or hide fields based on selections in other fields.

  • Update Field Names and Layout: Modify field names and placements in the catalog item form layout as needed.

  • Adjust Field Types and Choices: Ensure the field types and choice options are updated according to the requirements.

  • Conditional Field Hiding: Implement Client Scripts to hide or show fields based on specific conditions.

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand. 

 

Community Alums
Not applicable

Hi @Satishkumar B,

I checked all the fields under 'unique' column for this table cmdb_ci_service_auto, all are false, so I can't know.

Regards

Suman P.