Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Making field mandatory for inbound integration

Ankita9
Tera Contributor

Hi,

How can we make below fields mandatory for an inbound integration?

Record should be created only if below fields have validate data, Please suggest.

Mandatory Fields: 
1. Display Name
2. Full Name
3. Source Identifier
4. CI Source
5. Status
6. Criticality Classification
7. CI Owner Group 
8. Support Group
9. Approver Groups 
10. HA Configuration 
11. Environment
12. Install Status
13. Description
14. Class

 

Thanks in advance!!

1 ACCEPTED SOLUTION

Hi Ankita,

If you are using scripted REST API and have shared that endpoint; you can check this link where I have shared solution

Return Error Message for missing Mandatory field via Scripted Rest API

OR

if you are using import set API then you can use onBefore transform scripts; you can ignore that row

something like this

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	// Add your code here
	if(source.u_field1 == '' && source.u_field2 == '' && source.u_field3 == '')
	{
		ignore = true;
	}

})(source, map, log, target);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Chandu Telu
Tera Guru

Hi Anikta,

 

It's can achieved in mulitiple ways

  • Data Policy
  • Return Error if field is empty in the inbound Integration itself

Thanks
Chandu Telu
Please Mark Correct/helpful, if applicable,

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

There is no direct way to handle this.

You will have to skip the record insertion if the fields are empty.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

Thanks for your response.

Could you please help with the Syntax/ sample code.

 

 

Hi Ankita,

Check the below link similar question in answered

https://community.servicenow.com/community?id=community_question&sys_id=c98916efdbb174d4ae03d9d968961928

Thanks
Chandu Telu
Please Mark Correct/helpful, if applicable,