Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7542503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:11:02+00:00 2026-05-30T08:11:02+00:00

I have the following (from Tridion PowerTools ), which gets a user name from

  • 0

I have the following (from Tridion PowerTools), which gets a user name from the CoreService when some JavaScript runs.

JavaScript (Anguilla):

PowerTools.Popups.Example.prototype._onbtnGetUserInfoClicked = function () { 
    var onSuccess = Function.getDelegate(this, this._handleUserInfo);
    var onFailure = null;
    var context = null;
    //call function
    PowerTools.Model.Services.Example.GetUserInfo(onSuccess, onFailure, 
                                                  context, false);
}; 

// Delegate function "onSuccess"
PowerTools.Popups.Example.prototype._handleUserInfo = function (response) {
    var p = this.properties;
    $j("#lblUserInfo").text(response.UserName);
};

CoreService side: (C# .svc)

[OperationContract, WebGet(ResponseFormat = WebMessageFormat.Json)]
public ExampleData GetUserInfo()
{
    var coreService = Client.GetCoreService();
    _exampleData = new ExampleData()
    {
        UserName = coreService.GetCurrentUser().Title
    };
    return _exampleData;
}

This sends an asynchronous call:

PowerTools.Model.Services.Example.GetUserInfo(onSuccess, onFailure, context, false)

Whereas this assigns a different function to handle the response:

Function.getDelegate(this, this._handleUserInfo)

But where does onSuccess, onFailure, context, and the Boolean come from in: PowerTools.Model.Services.Example.GetUserInfo(onSuccess, onFailure, context, false)?

This four-parameter signature doesn’t match the no-paramater GetUserInfo() in the service code. Why that order and these four?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:11:04+00:00Added an answer on May 30, 2026 at 8:11 am

    The onSuccess and onFailure are the callback functions that are assigned for handling the response from the WCF service.

    Assuming this is code from the PowerTools project, there is an auto-generated JavaScript method that acts as a proxy method for a WCF service (source of the service is here) method called GetUserInfo().

    In there you can actually see the call to the CoreService. That should explain to you the mapping of the proxy parameters.

    1. onSuccess is the function to process the response of the WCF service
    2. onFailure is the function to run if the call fails
    3. context is a variable that will be passed back into your callback functions, so you can use it to pass things around.
    4. false is whether the call is synchronous or not

    If your WCF service were to take parameters, the generated proxy would form a different signature, something like

    PowerTools.Model.Services.Example.GetOtherInfo(param1, param2, onSuccess, 
                                                   onFailure, context, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to install ruby-mp3info. I have the following URL from which I
I have the following code from a legacy app which currently reads from an
I have the following function from some legacy code that I am maintaining. long
I have the following script from http://javascript.about.com/library/bljver.htm <script type=text/javascript> var jsver = 1.0; </script>
Let's assume we have following models: from django.db import models class Foo(models.Model): name =
I have following from rake routes: user GET /users/:id(.:format) {:action=>show, :controller=>users} But when I
I have the following: from django.contrib.auth.models import User class ClientDetails(models.Model): created_by = models.ForeignKey(User) ...
I have the following HTML from MVC1. <img alt=<%= Html.Encode(item.Name) %> src='<%= this.Url.Action(Image, Products)
I have the following code (from a previous question on this site) which retrieves
I have the following XML from which I am trying to generate HTML files.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.