- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 06:52 AM
Hay,
i have a Field Script searching for CIs in CMDB.
When this CI does not exist or it has the wrong status. I end the function with a return;
Choice Action is reject!
My problem is that the record is created anyway. The field value is undefined.
I already have it with
return "0";
reurn NULL;
etc. are tried.
I thought that with reject no value is written and no record is created if the reference is not found...
Which return value is needed to make reject work?
Target Field Name Installed on Ref: cmdb_ci
Choice Action: reject
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 07:01 AM
Hi,
you don't need to add anything in return, simply select the Choice Action to reject.
For any further information, please refer to the following official documentation:
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 07:01 AM
Hi,
you don't need to add anything in return, simply select the Choice Action to reject.
For any further information, please refer to the following official documentation:
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2020 01:20 AM
if you don't want record in target reference table to be created then you can set choice action as ignore
if you want import set row to be rejected then your field map should look like this
answer = (function transformEntry(source) {
if(value found){
return sys_id;
}
else{
return -1;
}
})(source);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 05:24 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
If not, please let us know if you need some more assistance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader