Is there a way to enable change tracking for couple of entities programmatically? I could not find any api in Dataverse which can help to do this.
You cannot do that with webapi but you can definitely achieve this programatically.
you can either create console application or you can run code now plugin for xrmtoolbox and get this done.
Below code snippet for reference.
UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
Entity = BankAccountEntity,
ChangeTrackingEnabled = true //or false here
};
_serviceProxy.Execute(updateBankAccountRequest);
Microsoft docs for ChangeTrackingEnabled
Related
According to documentation on loopback, lb soap creates models of underlying soap based datasource. Is there a programmatic way to do this? I want to do it programmatically to facilitate a dynamic soap consumption through dynamically created models and datasources.
Disclaimer: I am a co-author and maintainer of LoopBack.
Here is the source code implementing the command lb soap:
soap/index.js
soap/wsdl-loader.js
Here is the code that's generating models definition and method source code:
exports.generateAPICode = function generateAPICode(selectedDS, operationNames) { // eslint-disable-line max-len
var apis = [];
var apiData = {
'datasource': selectedDS,
'wsdl': selectedWsdl,
'wsdlUrl': selectedWsdlUrl,
'service': selectedService.$name,
'binding': selectedBinding.$name,
'operations': getSelectedOperations(selectedBinding, operationNames),
};
var code = soapGenerator.generateRemoteMethods(apiData);
var models = soapGenerator.generateModels(apiData.wsdl, apiData.operations);
var api = {
code: code,
models: models,
};
apis.push(api);
return apis;
};
As you can see, most of the work is delegated to soapGenerator, which refers to loopback-soap - a lower-level module maintained by the LoopBack team too. In your application, you can use loopback-soap directly (no need to depend on our CLI tooling) and call its API to generate SOAP-related models.
Unfortunately we don't have much documentation for loopback-soap since it has been mostly an internal module so far. You will have to read the source code to build a better understanding. If you do so, then we would gladly accept contributions improving the documentation for future users.
In Sitecore 8, we are currently generating menu items using Glass Mapper's #RenderLink method. We have set the "languageEmbedding" attribute of the LinkManager Provider to "never" but glass seems to ignore this setting.
$RenderLink(mi, x => x.Link_URL);
creates
http://domain.com/en/topics/xxxx
Looks like you can do this on a per item basis (http://blog.falafel.com/sitecore-removing-languages-from-urls/) by doing the following:
Sitecore.Links.LinkManager.GetItemUrl(item,
new Sitecore.Links.UrlOptions
{
AlwaysIncludeServerUrl = true,
LowercaseUrls = true,
LanguageEmbedding = Sitecore.Links.LanguageEmbedding.Never
});
but I haven't been able to figure out how to get this into glass.
Does anyone know how to remove the "/en/" (language) from the link when using glass to render?
You can set this on the SitecoreField attribute of your model
[SitecoreField(UrlOptions = SitecoreInfoUrlOptions.LanguageEmbeddingNever|SitecoreInfoUrlOptions.AlwaysIncludeServerUrl)]
public virtual Link Link { get; set; }
Double check something else is not overriding this setting. I would do a /sitecore/admin/showconfig.aspx just to make sure there isn't another linkprovider which has patched the web.config.
Agree with the others. Check your showconfig. Failing that, do a search of all the config files. In my specific case, I found that Sitecore.Ecommerce.config was patching the linkmanager and wasn't showing in showConfig that it was doing so. After updating that config, the link manager functioned normally.
Note: Sitecore 8.0-u3, Active Commerce 3.2, SES 2.2
We are building some plugins in Microsoft Dynamics CRM by inheriting from IPlugin. We have these configured so they fire whenever an Account is updated.
The problem is the plugins are calling our services, which causes our service to respond with an update. We are doing some pretty hacky things right now to prevent these cyclical updates from happening.
We were wondering if there was a way to pass a value to the IOrganizationService service (the web service) that a plugin can look at. Our other system could send a flag ("hey, don't bothing sending an update!") and the plugin could skip calling back.
Can we pass parameters from web service to the plugins?
Good idea could be usage of custom flag-field. For example you add bit field and call it CallFromExternalSystem. So when you make an update from your external system through IOranizationService you just fill this flag with true field and in plugin you can check condition that this field is present in fields list so you have no need to call external system endpoint again.
We decided the correct solution was to use the value found in IPluginExecutionContext.InputParameters["Target"]. In the case of an Update, this returns an Entity containing attributes for all the attributes that were updated.
We basically have a list of attribute names we cared about. We loop through names and see if any of them appear in the entity attribute list. If so, we send an update to our other system. The good news is, Dynamics CRM ignores updates where the values don't actually change, so trying to update a value to itself is no-op.
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = serviceProvider.GetService(typeof(IPluginExecutionContext));
Entity entity = (Entity)context.InputParameters["Target"];
string[] fields = new string[] { "name", "statecode", "address1_line1" };
bool hasUpdates = fields.Where(f => entity.Attributes.Contains(f)).Any();
if (!hasUpdates)
{
return;
}
}
For my Flash Builder 4.6 Project I have a http service defined which looks at a url from our website.
What I'd like to be able to do though is to change the web service url on the fly within the app. i.e. using the existing url as default but having an admin/settings screen to change where the web service points (either stored in our sqlite database or in local memory).
This would be so that we could allow our customers to host their own version of the website/database but still be able to use/download the app through the app stores.
Has anyone had any experience with doing this?
EDIT: Adding some more details after the comments below.
When I created the HTTP Service through the FlashBuilder wizard it creates two web service classes a super class and a sub class which inherits from the super class. All of the code that the wizard populates goes into the super class.
I can assume that the code I need to put in would be in the sub class. But I do not know which function I'd put it in or how.
Below is a sample of the Super's constructor:
// initialize service control
_serviceControl = new mx.rpc.http.HTTPMultiService("websitehere");
var operations:Array = new Array();
var operation:mx.rpc.http.Operation;
var argsArray:Array;
operation = new mx.rpc.http.Operation(null, "loginRequest");
operation.url = "login.php";
operation.method = "GET";
argsArray = new Array("un","pw");
operation.argumentNames = argsArray;
operation.serializationFilter = serializer0;
operation.properties = new Object();
operation.properties["xPath"] = "/";
operation.contentType = "application/x-www-form-urlencoded";
operation.resultType = valueObjects.Data;
operations.push(operation);
_serviceControl.operationList = operations;
I'm not sure what property of the _serviceControl variable I would need to alter.
Also when I search for my website in my code it brings back a .fml file inside a .model directory which seems to get auto refreshed if I change the service url through the wizard. Would this not cause an issue?
I then have the challenge of accessing the user defined url. Within the app we use an sqlite database to store data but I think it would probably be better to use a 'SharedObject' which we also use to know what account they are logged into. How reliable is this? I assume I would be able to access this via the Service?
Though the awkward thing is that we were planning to have this configurable on a settings screen that would have been accessed after logging in. But to log in it would already need to know which server to point to.
if im reading your question correctly then your main ambition is to dynamically change the url for the services based on a user defined variable.
This is very easy to accomplish and even easier to accomplish if you are using parsley / spicelib.
a few points
dont change the code in the super file, this will get overwritten whenever the service gets refreshed. change everything in its generated sub-Class.
Shared Objects are very good for small quantities of data but should never be used for massive datasets i.e storing a big arraycollection.
Anyway here is how i achieve this.
In the SubClass you can change the constructor function.
Here is how i change my urls based on a config variable but you can just as easily use a SharedObject instead.
public function SubClassConstructor(){
if(CONFIG::DOMAIN_IDENT == "development" || CONFIG::DOMAIN_IDENT == "dev" || CONFIG::DOMAIN_IDENT == "d"){
_serviceControl.endpoint = "http://yoururl1";
}
else if(CONFIG::DOMAIN_IDENT == "production" || CONFIG::DOMAIN_IDENT == "prod" || CONFIG::DOMAIN_IDENT == "p"){
_serviceControl.endpoint = "http://yoururl2";
}
}
Of course this isn't exactly what your looking for but its a working solution, of course you can use Bindings to a Global ApplicationModel or direct reference to the SharedObject i guess you already know how to use the SharedObject.
Ask if you need any further help or guidance.
As cghrmauritius' solution didn't quite work for me, I am posting up the final solution that did work in my situation.
public function subConstructor()
{
super();
_serviceControl.baseURL = "http://url1";
}
Obviously for my final solution I need to implement the shareobject as well but overriding the url was my main priority.
I am writing a small app that links into Umbraco (a small stand-alone console application that will eventually run as a scheduled task on the server) and I'm using the Umbraco APIs (4.5.2) to make changes to the database/document.
Here is a fragment of what I'm doing:
IEnumerable<Document> documents = Document.GetChildrenForTree(parentDocumentId);
foreach (Document doc in documents.Where(d => d.Published))
{
doc.getProperty("myData").Value = "some data"; // Exception here
// ...other stuff here...
}
However I always get a NullReferenceException because there are no properties. This confuses me because I can see that there are 5 properties in the umbraco interface.
A colleague suggested that I use a Node instead of a document, however I can't even create one as I get a NullReferenceException from the Node class constructor.
Node myNode = new Node(-1); // NullReferenceException here
Does anyone have any ideas?
The document class gets/sets information from the umbraco database. Since your running code in an out of band console application it can't find the umbraco context. Therefore throwing a null reference exception.
You need to run the code inside of the umbraco process. There is a asmx webservice that exists for third party integration. /umbraco/webservices/api/documentservice.asmx
Another way of achieving this could be to use linq2umbraco.
for further details see http://our.umbraco.org/forum/core/41-feedback/7699-UmbracoLinq-in-console-app--Having-some-troubles
I checked out the 4.5.2 source recently, to find that populating Document and Node objects only requires a connection using umbracoDbDsn. So if you have an AppSetting called umbracoDbDsn which points to a valid Umbraco database instance, you'll be good.
HTH,
Benjamin