0

notes and replies

Hi 

I try to retrieve the notes and replies attached to a task (using the toolkit)

i am able to retrieve them with a shotgun_model instance

entity_type = "Note"

publish_fields = ['id',
'content',
'replies',
'created_at',
'created_by',
"tasks"
]

but what i get in replies is only the {id, content, type} 

[{'content': 'note 1', 'created_at': 1413484177.0, 'created_by': 'xx xxxx', 'replies': []}, {'content': 'note 2', 'created_at': 1413484197.0, 'created_by': 'xx xxxx', 'replies': [{'type': 'Reply', 'id': 5, 'name': 'Mais si , mais si ....'}, {'type': 'Reply', 'id': 4, 'name': 'note sure'}]}]

i d like to retrieve also the "user" and "date" of this reply in one pass. Is there a Reply entity somewhere ?

cannot figure out how to 

2) second Question, is it possible to retrieve the same notes/replies info from a query on task. On task i can only get the open notes content , but not the author nor created_at, nor replies details. If i could get that in one pass thru task query , i would give up my notes_model query of question 1)

 

Thx in advance for your support

 

댓글 4개

  • 0
    Avatar
    Manne Öhrström

    Hello!

    1)The Reply entity type holds the information around the reply, including the user and reply text. Try retrieving a list of replies rather than a list of notes, then pull in some fields from the note as part of retrieving the reply information (e.g. entity.Note.content to get the note text for example). 

    2) I don't think you can get tasks+notes+note replies in a single query. You would have to do it like you you do above, where you get a list of replies, and then ask for additional fields on linked entities. But getting the tasks would be tricky both because you are doing a douple hop and because the tasks fields on the note is a multi-link field!

    Hope this helps! If anything is clear, don't hesitate to reach out!

    Manne

  • 0
    Avatar
    Guy Dubost

    Hello Manne,

    The only problem remaining is that not all notes have replies, so querying thru the replies , you miss the notes without replies.

    So looks like neeed for 2-steps query Notes and reply that i would have preferred to avoid.

    Thx for the help

    Guy

     

    PS: Why Note and Reply entities are not exposed in the site preferences Entity List , is there a particular reason for that ?

  • 0
    Avatar
    Manne Öhrström

    Good point! Yes, it sounds like a 2 pass thing is unfortunately needed for this.

    I think the reason stuff is hidden from the prefs list is because they are consider "system" entities. For the full picture, go to the fields option on the admin menu and you'll see a listing of all the entity types, including low level ones!

  • 0
    Avatar
    Guy Dubost

    Ok Thx Manne

    have a good day

댓글을 남기려면 로그인하세요.