Discussion:
Return array of data objects in custom AIF service
(too old to reply)
Nav
2010-07-29 12:01:57 UTC
Permalink
Hi,

I have created a custom aif service to send back appointment for a day. the
appointments does not exist is database so cant use document service. I can
successfully send one appointment by using the custom data object class but I
cant find a way to send multiple appointments for the same day. any idea how
it can be achieved? any help will be highly appreciated.

Thanks
Axel Kühn
2010-07-31 12:30:03 UTC
Permalink
Hi,

there are 2 ways to achieve this.

The first solutions is to use a custom service and create the needed
elements and xml nodes with your own x++ code.

The second solutions is to create a temporary table and use this table for a
new document service.

Because of the reason that you have to collect the needed data yourselve in
both solutions i think to use a document service with a temporary table is
much more easier to build.

Create a temporary table with all the needed fields, create a new query to
query this table, use the aif wizard to build the needed aif service and
classes.
After that override the AxdClass (method prepareForQuery) and implement some
code to fill your temporary table and make the query use the temp table (ie:
_queryRun.setRecord(<tempTable>)).

You can find an example on how this can be implemented in detail in the
class AxdPriceList.

Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Post by Nav
Hi,
I have created a custom aif service to send back appointment for a day. the
appointments does not exist is database so cant use document service. I can
successfully send one appointment by using the custom data object class but I
cant find a way to send multiple appointments for the same day. any idea how
it can be achieved? any help will be highly appreciated.
Thanks
Nav
2010-08-02 08:35:03 UTC
Permalink
Hi Axel,

Thank you very much for your reply. I think we'll have to go with second
solution as I tried creating a class for custom object type, which was
successfull and I was able to return a single object(which in our case was an
appointment consisting of fromtime, totime, priority, subject etc) but I was
not able to send a collection of these objects (like a list of 2 or more
appointments for a single day).

so we are going to implement this using temp tables. Thank you once again.

Navid
Post by Axel Kühn
Hi,
there are 2 ways to achieve this.
The first solutions is to use a custom service and create the needed
elements and xml nodes with your own x++ code.
The second solutions is to create a temporary table and use this table for a
new document service.
Because of the reason that you have to collect the needed data yourselve in
both solutions i think to use a document service with a temporary table is
much more easier to build.
Create a temporary table with all the needed fields, create a new query to
query this table, use the aif wizard to build the needed aif service and
classes.
After that override the AxdClass (method prepareForQuery) and implement some
_queryRun.setRecord(<tempTable>)).
You can find an example on how this can be implemented in detail in the
class AxdPriceList.
Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Post by Nav
Hi,
I have created a custom aif service to send back appointment for a day. the
appointments does not exist is database so cant use document service. I can
successfully send one appointment by using the custom data object class but I
cant find a way to send multiple appointments for the same day. any idea how
it can be achieved? any help will be highly appreciated.
Thanks
Loading...