Is it possible to add values to a CRM 2011's optionset via a C# application?
These MSDN article, provide the code and examples for working with Global Option Sets
http://msdn.microsoft.com/en-us/library/gg509056.aspx
http://msdn.microsoft.com/en-us/library/gg509023.aspx
If you want to convert your local to global, check this out:
If you want to create Local Option Sets (the example is in javascript, but the same requests exist in the C# library):
http://mileyja.blogspot.com/2011/03/working-with-optionset-values-in.html
Yes. You can set an option set value by:
OptionSetValue optionSet = new OptionSetValue();
optionSet.Value = 2; // optionset value is an integer
yourEntity["yourdropdown"] = optionSet;
Related
If I create user setting variables called var1 and var2, is it possible to put the value of var2 inside of var1?
For exemple:
Properties.Settings.Default.var2 = "stackoverflow";
Properties.Settings.Default.var1; // //path/stackoverflow/morepath
Properties.Settings.Default.var2 = "test";
Properties.Settings.Default.var1; // //path/test/morepath
The short answer to your question is no.
A string is just a string and there is no piece of built-in functionality that will dynamically replace %var2% in your first variable with the actual value of the second or any other variable.
If you want to somehow change the values of the variables, you will have to write some code that does this for you.
Settings is essentially just an XML file, so there is no way you can dynamically inject a variable value into an entry.
However, you can achieve what you want at runtime by dynamically updating var1 based on var2's value using the Properties.Settings.Default.Properties object.
Here is an article that has some examples of dynamically updating entries:
https://codedocu.com/Net-Framework/WPF/Basics/Settings/WPF_colon_-Create,-write-and-read-settings-dynamically?2045
Properties.Settings.Default.Properties["var2"].DefaultValue = "your updated value goes here"
Moving on from my previous problem, now I need to add Triggers to my transitions in State Machine diagram. How to acheive this using C#. The following creates a transition and its gaurd value but the trigger is not getting added.
EA.Connector trans = psosDiagramElement.Connectors.AddNew(tb1[i].Text, "StateFlow");
trans.ClientID = GetElementByName(txtSourceElement.Text);
trans.MetaType = "Transition";
trans.TransitionGuard = tb1[i].Text;
trans.SupplierID = GetElementByName(cmb1[i].SelectedItem.ToString());
trans.Direction = "Source -> Destination";
trans.Constraints.AddNew("A", "Signal");
trans.Update();
I don't think that there is a direct API call available to update the trigger.
TransitionEvent property of connetor will only update specification value.
Workaround for updating trigger is to hit a direct query using below call.
Repsitory.Execute(TriggerQuery)
You need to update\add a value in t_xref with
name as MOFProps
Type as connector property
Behaviour as trigger and
Description column you need to update the GUID value of triggers ( it will also accept Comma separated value as shown in diagram below )
Sample Insert query: Insert into t_xref (Name,Type,Visibility,Behavior,Description,Client) values ('MOFProps','connector property','public','trigger','triggereaguid1,triggereaguid2','connectorid');
We are using Sitecore 8 update-5. We would like to check which values changed in a specific field during a publish. For this we are subscribed to the item:saved event handler. When extracting the ItemChanges parameter from the event arguments we use the FieldChanges property for that field. In the master database the FieldChanges dictionary contains only those fields that were changed and FieldChanges.OriginalValue and FieldChanges.Value contains the proper values (the old ones and the new ones). However when publishing from master to web DB it seems that the FieldChanges always contain all fields and the OriginalValue and Value properties are always the same. We tested this with items which were already existing in web database, using smart publish and a single language.
The question is this is how it should work or is this a bug?
Some example code:
var topicFieldID = new ID(RelatedTopic.FieldIDs.Topics); //getting the field ID
var changes = Event.ExtractParameter<ItemChanges>(args, 1); //in item:saved event handler
var oldIDs = changes.FieldChanges[topicFieldID]?.OriginalValue?.ToString().Split('|');
var newIDs = changes.FieldChanges[topicFieldID]?.Value?.ToString().Split('|');
and in our case the "oldIDs" and "newIDs" contain the same values in web DB
Regards,
Chris
While referring the the following example from MSDN site.
From the example the below code for assigning the properties of the newly created code for WorkItem object we can assign the value for properties like Title,Description for the respected WorkItem object.
Also referring the Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem Properties and Method there is no way to assign value for Severity.
WorkItem userStory = new WorkItem(workItemType)
{
Title = "Recently ordered menu",
Description =
"Description goes here."
};
Also, I tried to assign with the Fields properties but not got success.
userStory.Fields["Severity"].Value = "1";
Using the latest TFS API.
According to TFS 2010 API - Create WorkItems(Bugs) you can do it in the following way:
workItem.Fields["Microsoft.VSTS.Common.Severity"].Value = "1-Critical";
You should check the AllowedValues property for the Severity field:
workitem.Fields["Severity"].AllowedValues
I think default allowed values are:
1 - Critical
2 - High
3 - Medium
4 - Low
I have been using AuthorizeNet.dll ( https://github.com/AuthorizeNet/sdk-dotnet ) for last 6 months, it is working great! Recently I am getting following error for few transactions :
"A duplicate transaction has been submitted"
I do research online and found the following link that explain nicely
https://support.authorize.net/authkb/index?page=content&id=A425&actp=LIST
My question is: How can I pass value for the parameter 'x_duplicate_window' once I call the following method, CustomerGateway.cs -> public IGatewayResponse AuthorizeAndCapture(Order order)?
Or do I need to modify something inside the AuthorizeAndCapture method?
Or do I need to modify something inside the HttpXmlUtility.cs->ANetApiResponse Send(ANetApiRequest apiRequest)
I appreciate any help. Thanks
You do not need to modify the SDK code. It provides an API for CIM "extraOptions" via the Order.ExtraOptions property (which is itself an access point for AIM options not present by default in the CIM SOAP messages). E.g.:
Order order = ...
order.ExtraOptions = "x_duplicate_window=0"; // integer seconds, 28800 (8 hour) max; see AIM documentation
// (from comments) if you need to include multiple "extras", the delimiter is '&'
order.ExtraOptions = "x_duplicate_window=0&x_customer_ip=100.0.0.1";