In an Alchemy Plugin I would like to show a popup with a simple message like, "You are about to UnLocalize all Child Components. Do you want to continue" and then when the 'Continue' button is clicked to execute some Core Service code.

The AddUser Alchemy extension has a nice example but I am a bit lost with the complexity of the JavaScript and ASPX page. Is it possible to call the Controller web service directly from the aspx page using a jQuery AJAX call?

My understanding is that the CoreService code should be located in a Controller implementing the AlchemyApiController. The AddUser GUI Extension has a nice example:

public class AddUserController : AlchemyApiController
    public IHttpActionResult NewUser(UserInfoModel data)
    {  // .. magic happens here

2 Answers 2


You just need to make sure you call AddWebApiProxy() in the resource group for your dialog and then you can call your service methods like so:


You need to add another ".something" after Api if you have added a AlchemyRoutePrefix attribute to your service:


There are different ways in which you can handle the success or failure of that call. I personally prefer the Promise Pattern.

All of this is explained in the documentation in the 'Plugin Anatomy -> Web Services' section.


You should be able to call the alchemy service using code like the following:

// This is the Promise pattern that the webapi proxy js exposes. Look at another example to
// see how the callback method can also be used. Your WebAPI controller's route and route prefix
// attributes controls how the namespace is generated.
        .success(function (data) {
            // first arg in success is what's returned by your controller's action
        .error(function (type, error) {
            // first arg is string that shows the type of error ie (500 Internal), 2nd arg is object representing
            // the error.  For BadRequests and Exceptions, the error message will be in the error.message property.
            $messages.registerError("There was an error", error.message);
        .complete(function () {
            // this is called regardless of success or failure.

You might need to add a reference to your plugin's JS in the ASPX page since it is in a popup window.

Have a look in %TRIDION_HOME%\web\Alchemy\Plugins\<YOUR_PLUGIN_NAME>\assets\js to see the files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.