Custom Fields not showing in context data

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Fields not showing in context data

L1 Bithead

Hi all,


I have two custom fields. Initially, these fields were added to the context data even if they are empty. Now, they don't get added at all. This code used to work demisto.incident()['customFields']['fieldhere'] to grab the custom fields, but now it returns a KeyError error.


Any advice?

1 accepted solution

Accepted Solutions

L1 Bithead

fixed with  date_ack = demisto.incident()['CustomFields'].get('dateacknowledged')

View solution in original post


L4 Transporter

It should be demisto.incident()['CustomFields']['fieldname']


You can always print each get to make sure your getting what you think you're getting.  I.e print(demisto.incident()['CustomFields']) 


In regards to the fields, were the custom fields added after the Incident was created?  If so they won't be in the incident object as they didn't exist at the time of creation, you'll need to use the setIncident builtin command to add a value to make them appear.  


If it's a new Incident, make sure the fields are associated with the Incident Type or all Types before creation.

Ah, that's right! I did have 'CustomFields', but it still returns a KeyError. The fields are added to all incident types. Initially, I didn't need to set these fields. I could just access them via that code. But now it's not working. They are not showing in new incidents.

L4 Transporter

Is the field perhaps restricted to specific Incident Types?  And the Incident you are testing on isn't one of those?

I don't think so. The 'Add to all incident types' is checked.

What I'm trying to do is check if the field is empty or not. If it's empty, add a value. But I'm unable to do this because when I check for the field, I get a KeyError error. (FYI: I'm trying to do these things via automation)



L1 Bithead

fixed with  date_ack = demisto.incident()['CustomFields'].get('dateacknowledged')

  • 1 accepted solution
  • 5 replies
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!