Roles and read only fields in MS Dynamics CRM - javascript

I am using Microsoft Dynamics CRM 2011. We have an entity with a "password" field. This field appears as a MD5 hash. Most users can manually modify this MD5 hash. Some other cannot. I can't find the setting specifying what users can edit this field.
I tried modifying the security roles to align it to a person who can edit the field but it doesn't seem to have any effect on that person. Maybe this is handled at user group level ? I can't find it there either.
Maybe this is coded in a JS script, but I don't find it. Maybe it's done simply in the UI without any script.

Check Field Security Profiles.
Check if any JavaScript has been added to the CRM form.

Related

Safely adding a customizable "tracking code" field to php web application

I have a small web application written in vanilla PHP with MySQL database, on which registered users are able to create custom profile pages.
Id like to add a textarea form field in the control panel, for users to add their custom tracking code (namely Facebook Pixel or Google Analytics) for their tracking purposes.
My question is, what is the correct way to add such functionality? I'm afraid letting my users to "inject" custom code would lead to security issues for my website. As far as i know the aforementioned tracking codes use regular JS/HTML for their tracking. If that is the case how to allow JS while restricting server side code, like PHP, from being executed?
Any help would be greatly appreciated.
The tracking code is always the same, apart from one or two elements. For instance, in a Google Tracking code the only variable element is a tracking ID in the format: UA-XXXXX-Y.
You could let the user select which type of tracking they want and let them only enter the tracking ID, and perhaps one more variable. You can easily check whether these have been entered in the correct format. From that you can generate the Javascript code yourself.
Alternatively, now that you know the code is always the same you could also use that to check what has been entered. Strip out any non-linguistical elements like space, and check it against your template: Only the ID's should be variable and you know their format.
However, I think this last method is less user-friendly, because it relies on the users to provide you with a rather exact copy of the code. That might be too difficult, and that will be your problem.

In Dynamics CRM, How can I update the CreatedOn date?

Has anyone had success updating the CreatedOn field in CRM? How can I do this? I've seen a few vague posts saying to use a pre-sync operation, but it'd be helpful to have more information than that.
Any help would be greatly appreciated. Thanks!
It's little tricky.
CreatedOn is system generated field, if you want to preserve the value from some legacy system, then pass the legacy value in overriddencreatedon field. CRM knows you want to put this overriddencreatedon field value in system generated CreatedOn field instead.
This has to be done before DB transaction, and only platform can do that. You can do this with code solution: Pre-operation plugin or no-code solution using CRM import.
PRESERVE OR OVVERRIDE CREATEDON, CREATEDBY, MODIFIEDON, MODIFIEDBY FIELDS
Refer Byron Community Answer
If data is already in CRM, then you have to copy/re-import the new data, at the same time deactivating the old records. You cannot simply update this field in client side (javascript).

CRM2011 check if notes on custom form contains data via JavaScript

Hi peeps on stackoverflow,
Product: CRM2011, should be latest roll-up
I'm currently trying to get the following to Work:
- A custom CRM form has been made. This form contain the 'Notes' tab. I would like to dynamically 'expand' this IF and only IF the 'Notes' tab contains notes data. I'm trying to do this through JavaScript loaded into 'Form Libraries'. I can easily 'expand' the notes field but I'm having serious trouble determining if the 'Notes' tab contains notes data.
I can understand that accessing the 'notes' data through the DOM is not a good idea so I've tried through XRM. Looked through https://msdn.microsoft.com/en-us/library/gg334351(v=crm.5).aspx to see my options. But I can't seem to get to one where I can access 'notes' and base the expansion of the notes field on if there is data or not in 'notes'.
Is this possible? I'm looking forward to hear from you and thank you very much.
Notes are their own entity type, entity logical name is Annotation, that is why you won't find the notes data within Xrm.Page. I'm making some assumptions here, but if you've set up this custom entity to follow standard conventions, any notes on that record will be separate Annotation records with a reference to the custom entity record. using the sdk.jquery.js script provided with the SDK you can do a query on Annotation records that reference the record you are currently on. That would be a supported way to determine if the record has notes. Using the OrganizationData.svc endpoint you would have an OData query that looks something like this
AnnotationSet?$filter=ObjectId/Id eq guid'34d19133-c0ec-e311-b39c-6c3be5bd2b14'
The guid value there would be the guid of the record you are currently on, which if you haven't already acquired within your script, you can get it pretty easily with something like this
window.parent.Xrm.Page.data.entity.getId().substring(1, 37)
or without the window.parent prefixing it

CRM Javascript RetrieveMultiple from M:M entity

I need to retrieve fields from all related records into a parent entity. I have got it working in a 1:M relationship, however I can't figure out how to get it working for a M:M relationship, because there is no relationship ID. I need to complete this through javascript. Can anyone help me out?
I'm not sure what version of (presumably) Microsoft Dynamics CRM you are using. I am going to assume you are using 2011. I'm also not fully clear on what you are specifically trying to acheive, but maybe this will help.
CRM 2011 provides an OData endpoint. This blog posting by Mark Kovalcson describes how it can be used.
To get the name and post code of an Account, you would use something like this as your select query:
http://crmserver/MyOrgName/XRMServices/2011/OrganizationData.svc/AccountSet(guid'5B19D04F-C48E-E111-92D4-00155D107003')?$select=Name,Address1_PostalCode
If you wanted to see all instances of child records via the N:N relationship with leads (called accountleads_association) you would use:
http://crmserver/MyOrgName/XRMServices/2011/OrganizationData.svc/AccountSet(guid'5B19D04F-C48E-E111-92D4-00155D107003')/accountleads_association
You can combine the two by using the $expand query option:
http://crmserver/MyOrgName/XRMServices/2011/OrganizationData.svc/AccountSet(guid'5B19D04F-C48E-E111-92D4-00155D107003')$select=Name&$expand=accountleads_association
More details on OData query options here
In order to do this I used an IFRAME and displayed the data through the IFRAME instead pulling CRM information through the query.

Automating Web of Knowledge H-index output

I'm a research student looking to compare the H-indexes (a measure of how often a scientist's work has been cited by others) of a comma-separated list of people. Web of Knowledge has a javascript form that lets you enter the author's name (field) and their institution (radio button). The h-index is then given as html. How would I go about automating the search and culling out the h-index value for each researcher?
One fairly simple way would be to write a script that uses curl to simulate a submission of the form over the data set you want to use. You'll need to know the form type (POST or GET) and what the parameter names are, then you can fill them out, feeding in data from the command line, a file, or a constant to your script.
The only trick here appears to be that Web of Knowledge will require you to authenticate to use this form.

Categories