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

SN_Learn
Kilo Patron
Kilo Patron

Hi @Community Alums ,

 

Is this a catalog item or record producer?

The catalog request on submission creates a REQ and RITM and this wont create duplicate records. Now you have to identify when do you call a record as duplicate? What will be the criteria/conditions to call a record as duplicate/collision?

 

If from record producer you are creation on a target table, then you have to compare it with the unique field of it.

Please provide some more details to provide some more insights.

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

Community Alums
Not applicable

Hi @SN_Learn,

This is not a Record Producer. It is a regular catalog item.

fyi

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

Regards

Suman P.

Okay, In that case it will always create unique REQ and associated RITM records(s) upon submission of the form.

You need to identify the conditions(variables maybe) which will be considered to identify whether existing records have the same variable value or not.

 

Please check with your team to identify what will be exact criteria to identify collision.

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

Community Alums
Not applicable

Hi @SN_Learn,

As an example, for the name sake, if cmdb_ci_service is the table name, and u_application_code is the unique field, how can I proceed please?

Regards

Suman P.

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.