@@ -235,15 +235,16 @@ def find_aog_item_by_grant_id(grant_id):
235235 items_found = []
236236
237237 # Check if there's a table structure in the response
238- for table_name , table_data in data .items ():
239- if table_name == "Columns" or table_name == "Filter" :
238+ for key , val in data .items ():
239+ if key != "Data" :
240240 continue
241241
242- if isinstance (table_data , list ):
243- for page_data in table_data :
244- if isinstance (page_data , dict ) and 'response' in page_data :
245- items_found .extend (page_data ['response' ])
246-
242+ if isinstance (val , list ):
243+ for page_data in val :
244+ if isinstance (page_data , dict ) and '_created_by' in page_data :
245+ items_found .append (page_data )
246+
247+ #print(items_found)
247248 # Search through the items for matching Grant ID
248249 for item in items_found :
249250 # Check various possible field names for the Grant ID
@@ -298,7 +299,7 @@ def update_aog_kyc_comments(item_id, legal_identifier):
298299 }
299300
300301 # Get current item details using admin endpoint
301- get_url = f"https://{ subdomain } .kissflow.com/process/2/{ account_id } /admin/{ process_id } /item/ { item_id } "
302+ get_url = f"https://{ subdomain } .kissflow.com/process/2/{ account_id } /admin/{ process_id } /{ item_id } "
302303 get_response = requests .get (get_url , headers = headers )
303304
304305 if get_response .status_code != 200 :
@@ -310,10 +311,13 @@ def update_aog_kyc_comments(item_id, legal_identifier):
310311 # Update the KYC_Comments field while preserving other fields
311312 current_item ['KYC_Comments' ] = legal_identifier
312313
314+ # Remove all fields starting with '_' before sending to Kissflow
315+ filtered_item = {k : v for k , v in current_item .items () if not k .startswith ('_' )}
316+
313317 # Use admin PUT endpoint to update the item
314318 put_url = f"https://{ subdomain } .kissflow.com/process/2/{ account_id } /admin/{ process_id } /{ item_id } "
315319
316- response = requests .put (put_url , headers = headers , json = current_item )
320+ response = requests .put (put_url , headers = headers , json = filtered_item )
317321
318322 if response .status_code == 200 :
319323 logging .info (f"Successfully updated AOG item { item_id } with legal identifier { legal_identifier } " )
0 commit comments