How to target these fields "Resolution code" and "Resolution notes" of Incident form by using transform map ?

antoine_jouenne
Tera Contributor

Hello community,

I'm running into an issue, I have to import by using a transform map multiples records into [incident], it turned out some of them can't be created and the following message error appears "Data Policy Exception: The following fields are mandatory: Resolution code".

That said, I could expect this message because "Resolution code" is mandatory as soon as state is on "Resolved" and only tickets with this specific state couldn't achieve their way to the instance.

As far as I know, these two fields are part of the tab "Resolution Information" which lead me ask myself if they have to be mapped as I used to normally do but it seemed not.

Does anyone could help me?

Cheers

Antoine

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it is because of this data policy which is OOB

Name: Make close info mandatory when resolved or closed

It is running on the Import Sets a well

If you want to skip this then uncheck that checkbox of

Apply to import sets - false

But remember from reporting point of view users will see empty resolution code and resolution notes for resolved incidents

Please set some default values from the field maps via the transform map

find_real_file.png

Regards
Ankur

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

please check the data policy on incident table.

it is restricting it because you are setting the value when you are trying to resolve it via transform map

Regards
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it is because of this data policy which is OOB

Name: Make close info mandatory when resolved or closed

It is running on the Import Sets a well

If you want to skip this then uncheck that checkbox of

Apply to import sets - false

But remember from reporting point of view users will see empty resolution code and resolution notes for resolved incidents

Please set some default values from the field maps via the transform map

find_real_file.png

Regards
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

use onBefore transform script with sample below

give the close_code value you want - I just gave this

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

	// Add your code here

	target.close_code = 'Solved (Permanently)';
	target.close_notes = 'Closed from import set';

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

Regards
Ankur

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

Hi Ankur,

Thanks for your prompt reply. Tell me if I get wrong but if I copy/paste your script, no matter the value of my state, it will fill every resolution code and resolution note fields, right?

Based on your script, I added a line "if condition" in order to better suit my need but not sure to write it correctly because it doesn't work out as expected when I'm running it.

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

// Add your code here
if (state == 6 || state == 7) { // Resolved or Closed
target.close_code = 'Solved (Permently)';
target.close_notes = 'Closed from import set';
}

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

Any ideas where I could make a mistake ?