@@ -27,7 +27,17 @@ def get_contact_notes(self, van_id):
2727 logger .info (f"Found { tbl .num_rows } custom fields." )
2828 return tbl
2929
30- def create_contact_note (self , van_id , text , is_view_restricted , note_category_id = None ):
30+ def create_contact_note (
31+ self ,
32+ van_id ,
33+ text ,
34+ is_view_restricted ,
35+ note_category_id = None ,
36+ contact_type_id = None ,
37+ input_type_id = None ,
38+ date_canvassed = None ,
39+ result_code_id = None ,
40+ ):
3141 """
3242 Create a contact note
3343
@@ -42,6 +52,15 @@ def create_contact_note(self, van_id, text, is_view_restricted, note_category_id
4252 in the current context.
4353 note_category_id: int
4454 Optional; if set, the note category for this note.
55+ contact_type_id: str
56+ Defaults to 82 if no value is set. This value results in a null contact type in EA.
57+ input_type_id: str
58+ Defaults to 11 if no value is set. If the value is 11,
59+ the input type in EA will be listed as "API"
60+ date_canvassed: date
61+ Defaults to current date if no value is set. Dates should be formatted in ISO8601 standard.
62+ result_code_id: str
63+ Defaults to 205 if no value is set. This value results in a "Contacted" result in EA.
4564 `Returns:`
4665 int
4766 The note ID.
@@ -50,6 +69,20 @@ def create_contact_note(self, van_id, text, is_view_restricted, note_category_id
5069 if note_category_id is not None :
5170 note ["category" ] = {"noteCategoryId" : note_category_id }
5271
72+ contact_history = {}
73+
74+ if contact_type_id is not None :
75+ contact_history ["contact_type_id" ] = str (contact_type_id )
76+ if input_type_id is not None :
77+ contact_history ["input_type_id" ] = str (input_type_id )
78+ if date_canvassed is not None :
79+ contact_history ["dateCanvassed" ] = date_canvassed
80+ if result_code_id is not None :
81+ contact_history ["result_code_id" ] = str (result_code_id )
82+
83+ if contact_history :
84+ note ["contactHistory" ] = contact_history
85+
5386 r = self .connection .post_request (f"people/{ van_id } /notes" , json = note )
5487 logger .info (f"Contact note { r } created." )
5588 return r
0 commit comments