Is it possible to add a CodeAction to the declarative .dialog file somehow? Or what is the current way of calling custom code from a trigger action?
There is no way to use code actions with declarative dialogs. You'll have export the runtime and follow these instructions: https://learn.microsoft.com/composer/how-to-add-custom-action
Related
I know I can add any CLI option via kedro_cli.py.
but I can't find out how to change what hooks are loaded dynamically.
I'm using kedro-mlflow, which features are provided via hooks.
And sometimes I don't want to log MLFlow temporarily.
If it's possible, please show me an example of ProjectContext code.
If the hooks have an entry-point as described in https://kedro.readthedocs.io/en/stable/07_extend_kedro/05_plugins.html#hooks , you would be able to disable it by specifying in .kedro.yml https://kedro.readthedocs.io/en/stable/07_extend_kedro/04_hooks.html#disable-auto-registered-plugins-hooks but you might have to ask the maintainer of kedro-mlflow plugin to add auto-registration first.
I am trying to implement some code for a GUI using openwrt and luci.
I would like to know how to implement a button or a formulary that trigger a lua command when the user submit it.
I make a lua script using ubus to control gpios and relays and now I am trying to make a GUI in which users will be allowed to control each GPIO and relays through ubus commands.
I know the commands to call ubus methods through the GUI.
I did a new page with several graphic items. Is it possible to implement a button/formulary which changes a variable and this variable will be used by a lua script?
Thank you.
Yes, there's two simple methods that can achieve this:
POST/GET request to controller.
Using Lua functions in the HTM.
The first one should not be hard to understand conceptually and you can read about POST/GET requests in JavaScript (AJAX) here: https://www.w3schools.com/jquery/jquery_ajax_get_post.asp
The second option is fine for something incredibly simple (or for testing purposes), but I would advise against using it over the first one just because there is less to type. All you need to do is simply surround your Lua code with <% (code goes here) %>.
However, there is another way which does not rely on Lua/JavaScript at all. You can make a config file (as it does seem you are saving something to it) and make an init script launch the service/change some parameters after any change to the configuration file using procd. Here's an example of how to do that: https://openwrt.org/docs/guide-developer/procd-init-scripts
Use curl commands, you can trigger a curl command when button is pressed and there by you can achieve your functionality
I am working on designing a lengthy approval system in CRM using a combination of OOB workflows (designed using CRM UI Workflow Designer) and custom actions (actions written using .NET code). Idea is to keep the entire branching/simpler logic in OOB workflow and call custom Actions wherever necessary. However I have few questions with this approach:
How can I handle run-time errors generated in the action code?
For example, one of my Actions contain the code to push data to an external system via web service. In case this web service call fails, I need to perform some steps in the parent workflow.
How can I handle 'if conditions' which can't be handled by 'Check Condition' step? For example, suppose that before performing a certain workflow step I need to check some data which can't be queried within CRM. I can create an Action which will return true/false based on the custom logic which can then be checked in parent workflow.
An alternate approach would be to use plugins but I am inclined towards using OOB functionalities as much as possible. Any inputs would be helpful.
First of all let's clear the semantics, because I'm not sure if you understand what are you talking about - there are Actions (you can refer to them as custom actions, but then you should refer to every workflow you create as custom and I figured out of your post that you are describing them as OOB, which also is semantically wrong - every workflow you create is a custom workflow, maybe it's using OOB steps, but that's a different story) and Custom Workflow Activities. I'm assuming that you want to use Custom Workflow Activities, because the are more suited for what you are trying to achieve here. Also you tagged your question as CRM 2011 and CRM 2013 - not sure what you meant, because Actions were not available for CRM 2011.
So basically Custom Workflow Activities can have Input and Output parameters. Output parameters are answer to both your questions, because you can use them to get the error message after your custom processing or use then in conditional statements later in your workflow. Output parameters can be defined like that:
[Output("Error message")]
public OutArgument<string> ErrorMessage { get; set; }
You can find more examples here:
https://technet.microsoft.com/en-us/library/gg327842.aspx
You can of course set this properties simply by calling
ErrorMessage.Set(executionContext, messageText)
So now when you define your workflow, wherever you need something not configurable in OOB blocks, you can put your Custom block, after it's done simply check it's output for the error (this is just an example, you can pimp it up by adding additional output parameters, to make it more generic), if it's empty then do something, if not then do something else for example send email with the error message. It all depends on what are you trying to achieve.
Actions are serving different purposes, they are useful to create a logic that can be easily called through plugin or javascript (webAPI) and allows you to also put a plugin on it alongside doing everything within one transaction. Maybe it will be useful somewhere in your workflow, but as far as I remember in CRM 2013 actions could not be called from a workflow...
UPDATE:
Ok so if we are dealing with CRM 2016, we can call Action from a workflow. What is best in this situation really depends on the scenario and what we are trying to achieve, but to make it easier to decide let me highlight main differences:
1) Activities are simply a blocks of code that can be put inside your workflow. Actions by themself are not code, they are custom Messages that you can call. Of course you can register a plugin on this custom Message and do there any custom logic you want, but this is another step to take
2) Actions can be run in transaction, Activities not (but you can run Activities inside Actions, so in this case they can run in transaction)
3) Actions can be called directly from Javascript, plugins and workflows. It's a great thing, but if you will make let's say 10 custom Actions which you will be using ONLY inside you one workflow, they will be visible when you will be registering plugins (and also any js developer will be able to call them with JS)
So basically Actions are a big, fat feature that can serve many purposes (including running Activities on their own!), Activities are much simpler but in your case they will also do their job. So you should ask yourself questions:
Do I need my logic to run inside transaction?
And
Do I need to call this logic somewhere else than my workflow?
If you have any "Yes" then go for Actions, of no, then go for Activities, because you will be overcomplicating things without any good reason.
I'm using VS2013/CodedUI and my palybacksetting is as follow:
Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
I also have a 3rd party tool that I have integrated to my code that does some action that codedui can't...Iw an to be able to log those steps into the ActionLog.html file with where codedui capture the actions and screenshot.
I searched a lot but didn't find anything on how we can achieve this.
thanks in advance for any help
I posted a response over here: Writing Custom HTML Logs
It sounds like there's not a good way to do this. You can get the path to where the html file lives and write a custom logger from there. I'm not sure it'd be safe to try and write to it while your test is executing, but perhaps once your test is complete.
On a related note to this question, say I've got an file with an handler defined, how would I programatically invoke the registered handler? Don't necessarily need the actual code to do this, just a pointer to some docs or the terminology to google for this.
Thanks,
Chris
It is sufficent to start a new process specifying the file you want to open with the default application - the rest is handled by Windows. In C# this is done as follows.
Process.Start("Foo.jpg");
This will open the image using the default application for JPEG images.
There's the ShellExecute function and its advanced cousin, ShellExecuteEx.