Zum Hauptinhalt gehen

Invoke workflow on page load

Kommentare

10 Kommentare

  • Permanently deleted user

    I would be interested in doing the same

    0
  • Ryan Cooney

    There isn't really a PageLoad event available to you since we are using MEF and Prism to load the modules and views. The SiteInitializedEvent is probably the most appropriate event for you. It will fire after the site and map have loaded and provide you with access to both. Have a look at the Event Reference section of the Viewer Admin Guide or in the Quickstart Guide for more details on how to subscribe to Prism events.

    There is also a built-in concept of the viewer called Startup Workflows. In the Workflow module in Viewer.Defaults.xml you can specify workflows that you want to automatically run on startup. As it happens, these will run in response to the site initialized event.

    <RunAtStartup>

     

      <Workflow Id="MyWorkflow"/>

     

    </RunAtStartup>

    --Ryan

    0
  • Permanently deleted user

    There are two ways to do this.

    The first way would be to create a custom Silverlight module for the viewer, invoking the workflow using the command RunWorkflowById once the site has initialized. The event SiteInitializedEvent is fired when the site initializes, so you'd want to listen for that. You'd also want to initially check if the site is already initialized, in case it has been initialized by the time your module starts up.

    The second, possibly easiest way to go about this is to do the same thing but from JavaScript. We offer a way for JavaScript and the Silverlight viewer to interact using commands and events. You can find an example of this in either the Bing or Google Maps integration examples in the "WMI" subfolder of a deployed viewer, and also in the viewers Index.html.

    Running a command looks like this:

    silverlightPlugin.Content.essentialsViewer.RunCommand("RunWorkflowById", "MyWorkflow");

    You probably want to subscribe to the SiteInitialized event in the "onViewerLoaded" method in the page (called automatically by the viewer), and run the command in the SiteInitializedEvent handler.

     

    Cheers,

    Jason

    0
  • Permanently deleted user

    Adding the 

    <RunAtStartup>

     

      <Workflow Id="MyWorkflow"/>

     

    </RunAtStartup>

     

    in the Viewer.Defaults.xml did the trick, Many Thanks

     

    Craig

    0
  • Permanently deleted user

    Thanks a lot for the replies! I got it.

    0
  • Permanently deleted user

    I see that you can modify viewer.default.xml but how can you apply a workflow startup for a given site.  Say I wanted the "hello world" workflow just for the "test workflow start up" site.  how would I implement the workflow on startup there?

    <RunAtStartup>

     

      <Workflow "Hello World"/>

     

    </RunAtStartup>

     

     

    J

    0
  • Permanently deleted user

    You should be able to add that to the specific site.xml since the site.xml takes precedence over the viewer defaults. 

    0
  • Permanently deleted user

    You'd actually make the change in the Viewer.XML for the particular site.

    There is now an option in the Workflow Section of the Viewer configuration (at least in Silverlight Viewer 1.7) to call a workflow on startup, so this thread may now be obsolete.

    All you need to do is select your workflow ID.

    0
  • Permanently deleted user

    Is there a way to do this in HTML5?

    0
  • Kevin Penner

    Look in the json config files. You can find the startupWorkflows property inside the configuration for the workflow module.

    Ex:

    "startupWorkflows" : [ "StartupworkflowName" ],

    -Kevin

    0

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