(get_party_ai_behavior) doesn't store the party ID, but instead what is the party up to in that time. (Going to siege, patrolling...etc)
If you want to store the leader of the party, use (party_count_members_of_type,<destination>,<party_id>,<troop_id>),...