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
Related
If you have a seller accounts at amazon or ever happened to look at their product upload form, I am sure you must have noticed that for each product type you wish to upload they have a slightly different form.
If you want to sell Table Fans, you are presented with this form
and in case you wish to sell shirts, this is what is presented you.
both forms are different yet do the same thing, i.e. upload products (which has some common and few specific attributes)
What intrigues me about this design is the thought that the end user, a layman, wouldn't be expected to understand jargon like product attributes or its use. You give him a product specific upload form and he will fill it up as necessary.
Looking at a few other carts, take for instance opencart
opencart has one form for all product types and if you need to add a few extra attributes it lays the onus on you (the end user) to first understand what attributes are then work as needed.
(this is opencart's add attributes as needed)
I like the way amazon (and a few other ecommerce site, I believe ebay too does as amazon) worked this up.
I wish to replicate this for my project but honestly speaking I have never seen this before. I do not even understand what do you call this. I tried searching google for "form based on product type" and could not find anything to help me.
Can you please let me know how amazon or ebay do this.
There are many different ways of implementing this. In general, you probably won't be able to do something this complicated with HTML and Javascript alone, you'll need a database and some sort of scripting language like PHP or Ruby on your server to dynamically generate the pages.
It's not clear to me what languages you'd want to use, so I'll give a general description:
On the back-end, in a database I'd create a table for the general product. This table would have a field for product type. Then I would create additional tables for the specific product types, and have these tables store all the additional fields, and the primary key referencing the entry in the main, general product table. I would then create a table for product type, which has the product ID's used in the field in the general product table, and a second field referencing the name of the table in the database that stores this type of product.
The code that is all in common between all types of products, I would have reference the general product table. I would then allow the user to specify the product type, and when this is clicked, send the user to a new page, which would run a script. The script would query the database to retrieve the table name for that data type, and then query the database for a description of additional fields specific to that data type, and display an appropriate form, dynamically generated based on what the database returns.
I'm trying to build a custom UI control in alfresco to display the associations of an object type that I have.
Basically I have two object types; Code, which is a key value pair, and CodeScheme which contains multiple child associations to codes, it's essentially a mirror of a map structure I have in a different system.
The problem I have is that the codes are automatically generated, so they get the UID names, whereas really I'd like to present them as 'key=value', 'key=value', etc (ideally I'd like to present it as a table).
I've already created a custom control and added it to share-config-custom, and confirmed that the configuration is working correctly. What I'm not really clear on now is:
a) How to attach a javascript to the control so that I can process the association data.
b) How to get hold of the codes in javascript, and read their properties.
I'm just looking for a push in the right direction.
Thanks :)
One idea would be to use a form filter. Your form filter could iterate over the child references, fetch each child node, grab the data you want to display and then add one or more new properties with that data.
Then, your form control is hooked to the fields your form filter dynamically added to the form data. It can then read and display the data as needed.
Without a form filter I think you'd have to use JavaScript to parse the child association refs and use AJAX calls to fetch each child's node data, then format that as needed. The form filter idea would be less traffic from the browser.
In a form in CRM2011 I am using a JavaScript function to retrieve some attributes from a custom entity unrelated to the one in the form.
I have a successful call to CrmRestKit.RetrieveMultiple but I don't know what the returned collection comprises. Can someone point me in the right direction, please?
To be a little more specific about the requirement: the query returns a set of Field schema names; i.e. the column being queried is in a custom entity and contains schema names of Fields. I want to match each one I retrieve against the calling form's collection of Field-based controls so that I can perform an action on matching ones. Any assistance towards that would also be gratefully received, thanks.
The easiest way I have found to know what you'll be working with is to take the output and run it through JSON.stringify() and write the contents of that out to the page.
For bits like this I usually just debug with IE. That will allow you to add breakpoints and inspect the object.
Related info: Debugging Script with the Developer Tools.
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.
Hey i want to create a list instance with a definition that defines the following columns.
-Notice StartDate (DateTime)
-Notice EndDate (DateTime)
-Notice Message (Text)
-Notice Colleges (???)
I created the dates and message inside my list def i just have no idea what type should the Colleges column be. I just know it should be a list that represents multiple users.
Also i would like to be able to call a Javascript function to Populate new item inside the list and delete them. Also if i retract the solution how will sharepoint deal with this ? Will items added to the list while the solution is deployed still be there when i redeploy ???
In response to your questions:
You can make Colleagues a 'Person or Group' column which allows for multiple values. Presumably, you want to render a list of all users from which the user can select? If you're doing this server-side, you could bind against SPWeb.AllUsers or SPWeb.Users depending on your needs. Note that neither of those will return all users in your NT domain if that's what you're after (that is a little more complicated).
If you want to manipulate SP lists using Javascript, you should look into using the Client Object Model.
If you retract your solution, the list items will remain there.