Pass parameter from dialog to custom worklow activity CRM 2016 - dynamics-crm-2016

I have a simple custom workflow activity with the following parameter:
[Input("String")]
public InArgument<string> String { get; set; }
In the execute method I only have a throw InvalidPluginExecutionException to show me the value of Sring:
throw new InvalidPluginExecutionException(String.Get(executionContext));
Then I created a dialog in crm 2016 with a page that asks for a text value and then I invoke the custom workflow activity with the value the user entered in the dialog.
But when executing after entering the text parameter the dialog gives an error when passing the value to the custom workflow activity:
Can somebody tell me what's wrong, the workflow activity parameter is just a string and the input in the dialog is also a string. If I take the parameter from the workflow and stop passing the argument from the dialog it runs as expected. I have also tried other types of InArguments ex.: int.

Related

Send e-mail from an action

We are using Dynamics CRM 2016 on-premise.
I want to create an action which sends e-mails among other things.
The action has two input parameters of type "string".
I am able to use the parameters when I create an entity or in conditions in branches.
However, I am not able to use these parameters when I choose the "Send e-mail" task or if I try to create a new entity record of type e-mail.
The expression designer shows "Search for: Arguments" but the list of arguments is empty.
Any ideas why that is the case?
Edit: Image one shows the action with 2 string argumengs. Image 2 shows that I can use the argument as topic of a letter. Image 3 shows that the argument list is empty when I try to do the same for an e-mail.
I recreated the action, changed the computer, used a different user account.
Action
Letter
E-Mail

Angularjs custom validation directive Async call real time validation

I am using custom validation directive to validate a field in a form and the validation process includes a AJAX call to verify user information with server API. We want to validate the field as long as user stops typing for a certain period of time.
I have two questions:
1.Why is the function below not working?(with link function in the custom directive) The log message was never shown no matter how many times I type in the binded input field (I am pretty sure I enabled log message display since other logs were shown correrctly)
scope.$watch(attrs.ngModel, function() {
$log.debug("Changed to " + scope.$eval(attrs.ngModel));
});
2.What is the best way to detect that the user has stopped typing for the program to execute the validation process? And is it possible to cancel the validation process before it is finished if user starts to type again?
attrs.ngModel will equal the string value in the html context. What you want to do is bind the ngModel value to the directive's scope:
scope: {
model: '=ngModel'
}
Then watch the directives scope:
scope.$watch("model", function() {
console.log("Changed");
});
example: http://jsfiddle.net/BtrZH/5/

Custom Workflow Activity ReferenceTargetAttribute for User OR Queue

In Dynamics CRM 2013 I want the input parameter of a workflow activity to be similar to the From Lookup on an E-Mail which allows looking up a User or a Queue.
I've tried using activityparty, but it does not work.
Is there a way to do this?
You can use this code to define an input parameter that accepts a User
[Input("FromEmail")]
[ReferenceTarget("systemuser")]
public InArgument<EntityReference> FromEmailRecipient{ get; set; }

Backbone.js: run validations and fire error events on set, but don't abort set if validations fail

I've got a Backbone model with a custom validate method that validates the format of one of a the model's attributes. My model is hooked up to a view that exposes said attribute via a text field. The view has a 'save' button that the user must explicitly press to save the model changes back to the server.
When the user types an invalid attribute value, I want to visually mark the field as being in an invalid state. So far, easy - I can bind the change event of the input field to a function that calls myModel.set({ attribute: value }), and listen for the "error" event on the model to tell when the validation has failed and I should mark the input as invalid.
The problem comes when I want to handle the save button click. Because Backbone.Model.set aborts actually setting the attributes on the model if validation fails, my model will not accurately reflect the value the user has entered unless the value is valid. When the user clicks save after typing in an invalid value, I check whether the model is valid, find that it is (because the invalid attribute was never actually set), and save the old (valid) attribute value to the server.
What it seems like I want is a version of set that always makes the requested changes, but also still triggers validations and events. set(..., { silent: true }) will allow the change to go through, but will not run validations or trigger events.
In short - I want my model to sometimes exist in an invalid state (if the user has entered invalid attribute values), and I want to be able to get events when it transitions between valid and invalid. Is there a graceful way to do this with backbone, or am I thinking about this completely wrong?
I suggest you use this backbone validation plugin https://github.com/thedersen/backbone.validation
Extremely helpful.
For your usecase (to allow values to be set even if they are invalid),
you just need to do override the set function of your model.
set: function (key, value, options) {
options || (options = {});
options = _.extend(options, { forceUpdate: true });
return Backbone.Model.prototype.set.call(this, key, value, options);
}
The 'forceUpdate' property of backbone.validation allows the validate method to return true, while still calling for validations.
After the save click, you can call,
var errors = model.validate(model.validate.attributes);
This will return all the errors that your model has and you can appropriately display them.
You also have callbacks for valid and invalid which you can use freely
What I've done with this sort of validation is to reset the models attributes from the inputs before save on the save click (only doing the save if the set doesn't fail)
This way the save button click re triggers the validation - triggering the error.
It means the model is always valid and you cant progress to the next page until the input is all valid.

Throw error on parameter validation fail in Reporting Servies 2008

I'm trying to validate user input on a text parameter using a VB function. I created a hidden text parameter whose default value is the expression =CODE.CheckParameter1(Parameters!Parameter1.Value).
This is the specified function:
Function CheckParameter1(Parameter1 as String) as Integer
If (Not IsNumeric(Parameter1)) Then
MsgBox("Please enter in a numeric value for Parameter 1", 16, "Validation Error")
Err.Raise(6,"Please enter in a numeric value for Parameter 1")
End If
End Function
What I want is for the report to throw an error message if the input is non-numeric. It catches the error properly, but it doesn't show my custom error message nor does it pop up an MsgBox.
How can I achieve this?
You won't be able to perform parameter validation like this in a straight Reporting Services solution. You can set the parameter to be an integer or a float and use the parameter checking that SSRS provides. Otherwise, you'll need to wrap the SSRS reports in a page (or app) of your own which gathers the parameters.
Msgbox is not supported in SSRS: it is a web application, running through a browser, and it can't popup a message.
An alternative is that you could have a conditionally displayed text box on the report itself that informed the user that some of the parameters were incorrect. This would still require the user to click the "View Report" button before getting the error.

Resources