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; }
Related
I am using filenet BPM for approval system and I want to extract the username from F_Originator so that I can send an email to originator about the status of approved Or rejected document. How can I extract the username from F_Originator in workflow (not using java code)?
I think I found a way to get the username although it's not making use of F_Originator. I created a string field called username & then at the launch step in Assignment tab I assigned username with userid() and it gives you the username. I think its not the best way to get the username but in my case it worked.
Answer suiting to the exact requirement
At launch step, assign output of userid() to a work flow data field
Use OOTB option to send email (CE_Operations) and edit the OOTB templates or
Have a component queue and establish a VWSession (or you can have custom login module to get VWSession)
Call yourVWSession.convertIdtoUserName(int userId) to get the username
then call yourVWSession.fetchUserInfo(username) it returns VWUserInfo
from VWUserInfo you can use getEMailAddress() to get user email id.
Hope this helps
I don't think there is a way to do it in workflow or at least I don't know.
I would suggest you have a component queue like ce_operations and pass the F_Originator and use vwSession.convertIdToUserName(userId)
**************updated answer************
you can use userid() method to get the user who has processed the workflow.
but there is a catch here if there are more than one user involved in processing the workflow, userid() will always return the last user. In order to get the username of the user who launched the workflow try
Define a data field in workflow and assign the value of userid() to it in the launch step
If you are launching workflow from code, you can set the username value to the data field
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.
I have created a custom entity and a matching plugin.
The plug-in registers on the Create message of the entity, pre-operation, and synchronous.
Via a rest call the plugin execution is triggered. The input is correct. But I can not get the data out to the client side.
Should I set OutputParameters, change the InputParameter, change plugin registration, ...?
Or should I retrieve the entity afterwards?
This pattern is described at
http://crm.davidyack.com/journal/2012/6/26/crm-client-extension-data-access-strategies.html under the command pattern segment
To update some values in record in Pre-Create you can use something like this:
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
Entity yourEntityName= (Entity)context.InputParameters["Target"]
if(yourEntityName.Attributes.Contains("SomeAttribute"))
yourEntityName.Attributes["SomeAttribute"] = "SomeValues"
}
Is that what you are looking for?
Change "SomeAttribute" for attribute name that you want to change and "SomeValues" for value that you want to pass into record.
On PreCreate event populate Text area with your results. At the end of Create, your entity will have this field populated with results. In rest call retrieve the entity after it is created and retrieve the results from Text area.
If you are using CRM 2013, instead of using custom entity and Plugin, you can use Actions to carry out server side execution and Actions can be called from REST calls. Actions is like any SDK Message where you can provide inputs and it will have Output.
hth
Thanks
Mak
Is it possible to have the Help Page sample generator ignore certain properties of a particular type?
For example, we use the same DTO for object Request and Response messages, for both POST and PUT requests. When user is POSTing a model (creating a new record) they don't need to provide the ID field.
But once its created and we serialize the new record into the response body, the ID field is included and returned to the client.
So in the POST request sample, I don't want the ID field to be displayed because for post request it doesn't make sense.
But the POST response sample, I do want the ID field displayed...
I am aware that there is the ApiExplorerSettings attribute which can be applied to a Class or Method...but is there anything similar for a Property?
Something like this would be great:
public class MyDTO
{
[ApiExplorerSettings(IgnoreForRequestApi = true, IgnoreForResponseApi = false)]
public int Id { get; set; }
// Other properties omitted for brevity...
}
Using the following annotation I've successfully hidden a property from the generation!
[ApiExplorerSettings(IgnoreApi = true)]
No, there isn't a similar option for a property. HelpPage uses formatter instances configured on the application to serialize the samples and as you can imagine the formatters must not have this knowledge within themselves.
Regarding workarounds:
a. You could explicitly set the raw sample for a particular action's requestsample via the SetSampleRequest extension of HttpRequestMessage. You should be able to see some examples about this in the file at *Areas\HelpPage\App_Start\HelpPageConfig.cs*.
b. In the file Areas\HelpPage\SampleGeneration\HelpPageSampleGenerator.cs, there is a method called WriteSampleObjectUsingFormatter which uses the application's formatter instances to write the samples. Here you would need to create new formatter instances having similar settings as your normal application has(so that they reflect the exact serialization/deserialization semantics that your application would normally react to when actual requests are made) and then try to hide the properties which you want to. We want to create new instances because we do not want to disturb the normal functioning of the application.
Example: In case of Json, you could create a new Json formatter instance and provide a ContractResolver which can hide the properties. Check this link: http://james.newtonking.com/projects/json/help/html/ConditionalProperties.htm
In case of Xml, I am not sure how we can hide properties without using the IgnoreDataMember attribute and also being non-intrusive.
Currently I would prefer option 'a' as its comparatively a simple workaround than 'b'.
ASP.NET WEB API uses Json.NET for JSON and DataContarctSerailizer for XML formatting so if you add [JsonIgnore] annotations over properties that you do not want included in your serialization should work just fine.
I have a case in my application where no two records should have the same Assessment name. To do so i am implementing this rule using the Remote validation attribute for both client and server side validation. As follow:-
[Remote("CheckAssessmentName", "Assessment")]
[Required]
public string AssessmentName { get; set; }
public JsonResult CheckAssessmentName(string AssessmentName)
{
var c = elearningrepository.checkname(AssessmentName).Count() == 0;
return Json(c, JsonRequestBehavior.AllowGet);
}
The problem is that the client side validation will be triggered each time the user insert or delete a character in the Assessment name field ,, so i am afraid that this will cause a performance issue assuming that i might have hundreds of assessment records, so should i use my current approach or there is a better way to do this?
Second question can i disable the client side validation for this specific Remote validation attribute for that i will only check the existence of the assessment name only on the server !!?
BR
No one can answer this for you without knowing your server stats, what else is running, network perf , query with or without indexes etc
Try it, just remember you have to check on the server side as well since remote validation does not automatically Validate again when you save your form meaning if JavaScript is off( or scripts havent loaded before they submit the form) then they can bypass the checks