Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

CallContext in System Services (AX 2012)

(0) ShareShare
ReportReport
Posted on by 400

Hi,

 

I've been looking for an example where you use the CallContext in System Services.

The documentation states :

The data contract for the call context is not published as part of the Web Service Description Language (WSDL) files for system services. However, the call context can be used just like for other services. The call context values for system services are set to the default values. If you want to explicitly set any call context values for a system service, you must create the code to set the values for the system service call.

 

But I have no idea how to create this code.

As example, I would like to use the ExecuteStaticQuery method on the QueryServiceClient.

But I want to choose in which company this query must be executed.

 

Does anybody has an example of this?

 

Regards,

Sven Peeters

*This post is locked for comments

  • Nima Kamoosi Profile Picture
    Nima Kamoosi on at
    Re: CallContext in System Services (AX 2012)

    See the following sample: code.msdn.microsoft.com/Walkthrough-of-using-73c07391

    Thanks,

    Nima

  • Suggested answer
    Tory Bjorklund Profile Picture
    Tory Bjorklund 125 on at
    Re: CallContext in System Services (AX 2012)

    Ok, here is what I learned.

    1. Joris dG is correct. This will work.

    2. However, ExecuteStaticQuery() doesn't use any meta data with which to set these parameters so here is what I did.

    I used the Metatdata service (msdn.microsoft.com/.../gg880762.aspx) to get the metatdata for the desired static query, then I set the values desired on the metadata (I also wanted to flatten the dataset) and then I called QueryServiceClient.ExecuteQuery() (msdn.microsoft.com/.../microsoft.dynamics.ax.framework.services.queryservice.queryserviceclient.executequery.aspx) passing the modified metadata.

    I am planning to write this up with a little more information (including sample code) and I will post it to my blog and place a link on this thread later.

    I hope that helps.

    Tory

  • Suggested answer
    Joris dG Profile Picture
    Joris dG 17,775 on at
    Re: CallContext in System Services (AX 2012)

    I couldn't find the context on the query service either. I ended up setting the query to crosscompany=true and then specify only one company in the company ranges.

    It's a workaround, but works well.

  • Sven Peeters Profile Picture
    Sven Peeters 400 on at
    Re: CallContext in System Services (AX 2012)

    Hi Tory, no answer and no solution what so ever.

    Very dissappointed that until today, no sample is released bij MS in their documentation

    If you find a way, please share it with us.

    I reverted back to the BC.Net connector for that particular customer.

    Regards,

    Sven Peeters

  • Tory Bjorklund Profile Picture
    Tory Bjorklund 125 on at
    Re: CallContext in System Services (AX 2012)

    Hi Sven,

    I am trying to find an answer to the same question. I see you have no response to this post. Have you figured out the answer on your own?

    Thanks,

    Tory

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans