Zum Hauptinhalt gehen

How to get notified when workflows executes "SetLayerDefinition" activity

Kommentare

6 Kommentare

  • Permanently deleted user

    Hi Bledar,

     

    You can use the Alert activity immediately following the SetLayerDefinition activity to display an alert dialog in the viewer to confirm that it was executed. It's important to note that the SetLayerDefinition activity does not automatically redraw the map, but you can use the RefreshMap activity to redraw the affected map service.

     

    Here is the link to the Alert activity in the docs: https://docs.geocortex.com/essentials/workflow/latest/help/Default.htm#wf/help/wf_A_Alert.htm%3FTocPath%3DReference%7CActivity%2520Library%7CCommon%2520Client%2520Activities%7C_____1

     

    If you are looking for an entirely different type of notification, i.e. not on the client side, let us know. More detail on what you're hoping to see will be helpful.

     

    I hope that helps!

    All the best,

     

    Stephanie
    0
  • Permanently deleted user
    Hi Stephanie,

     

    Sorry for the misunderstanding, but Bledar is looking to to get notified in the custom module code in the HTML5 Viewer running as version  2.8.2and not notify the user. Is that also possible?

     

     

    Martin

     

     
    0
  • Permanently deleted user
    This might be helpful to understand what we are trying to do

     

    We have the following code on Geocortex HTML Viewer 2.8.2 which is working fine :

     

     

     

    this.app.eventRegistry.event('FilterBuilderLayerDefinitionAppliedEvent').subscribe(this, (args: LayerDefinitionExpressionAppliedEventArgs) => {

     

                this._checkLayerFilters(args);

     

    });

     

     

     

    However this event is not triggered when the “SetLayerDefinition” activity is called from a workflow.

     

    Regards

     

    Martin
    0
  • Yona Bystedt
    Unfortunately there is no event that fires corresponding to this activity, either in our API or ESRI's, so the only solution is going to be a bit tricky. We would certainly consider adding an event for this in a future version of the viewer, but until then...

     

    Note that since this uses some private, undocumented variables this falls under the category of 'hack' and can't really be officially supported. Having said this, I do not *expect* this method to break going forward.

     

    So, in your custom module you should have access to the 'app' variable containing the viewer application. First, grab the 'Workflow' module: const workflowModule = this.app.moduleManager._modules["Workflow"]; There is a registered activity handler for the "SetLayerDefinition" activity here. Save a copy of this in your custom module: const setLayerDefinitionHandler = workflowModule.dispatcher._registeredActivityHandlers["Geocortex.Workflow.Activities.SetLayerDefinition"] Now we can replace it with one that fires an event for you. Alternatively you can do your work right in the handler if you don't need to notify anyone else: workflowModule.dispatcher._registeredActivityHandlers["Geocortex.Workflow.Activities.SetLayerDefinition"] = (activityContext) => { const eventPayload = { mapServiceId: activityContext.getValue("MapServiceId"); layerId: activityContext.getValue("LayerId"); layerName: activityContext.getValue("LayerName"); definition: activityContext.getValue("Definition"); }; this.app.event("LayerDefinitionSetFromWorkflowEvent").publish(eventPayload); setLayerDefinitionHandler(activityContext); }; Dont forget to call the original handler at the end!

     

    Hope this helps,

     

    Jonathan

     

     
    0
  • Permanently deleted user
    Hi.

     

    We are getting the following error on the first line only:

     

    Error    TS2445    Property '_modules' is protected and only accessible within class 'ModuleManager' and its subclasses.    

     

     

     
    0
  • Permanently deleted user
    I don't know if this will work for you, but why not register some custom command in your custom module, then and then fire that command from your workflow? 

     

    For example, here is a module I made to change the cursor over the map.

     

      /// <reference path="./../../_Definitions/Essentials.AMD.d.ts" /> /// <reference path="./../../_Definitions/Framework.AMD.d.ts" /> /// <reference path="./../../_Definitions/Framework.UI.AMD.d.ts" /> /// <reference path="./../../_Definitions/Mapping.Infrastructure.AMD.d.ts" /> import { ModuleBase } from "geocortex/framework/application/ModuleBase"; import { ViewerApplication } from "geocortex/infrastructure/Viewer"; export class CustomCursorModule extends ModuleBase { app: ViewerApplication; constructor(app: ViewerApplication, lib: string) { super(app, lib); } initialize(config: any): void { this.app.commandRegistry.command("SetMapCursor").register(this, this.setMapCursor); this.app.commandRegistry.command("ResetMapCursor").register(this, this.resetMapCursor); } private setMapCursor(cursor : string){ var mapElem = document.getElementById('map_gc'); mapElem.style.cursor = cursor; } private resetMapCursor(){ var mapElem = document.getElementById('map_gc'); mapElem.style.removeProperty('cursor'); } }

     

     

     
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.