How to have multiple entries for custom entity? - javascript

In our Dynamics CRM online custom project - we've the default ACTIVITIES tab in a custom entity named DocProject's form
ACTIVITIES is able to take multiple entries.
Also, there is NOTES tab in the same form
NOTES is also able to take multiple entries.
Okey, this is done by Dynamics CRM guys. So far so good.
In the same form, we also have a DocProjectActivities lookup field for a custom entity DocProjectActivities
This is a lookup field, hence it has got a 1:N relationship.
Clarification: Our problem is not only about Activities. WKT Notes also behaves similarly. We just need some config which will allow us to make multiple entries for one single field
Problem:
How do one makes sure that this custom entity DocProjectActivities allows to make multiple entries as that for ACTIVITIES & NOTES?

In order to have the associated activity grid like the one in the DocProject entity, you need to enable the option Activities when you're creating the entity (this option can't be changed after the entity is created). This option will create the association with the activities entities and allow you to track all the related phone calls, task, etc.
I think that the problem that you're having is that you defined the DocProjectActivities as an activity entity and therefore you can't have this kind of relationship with the other activities entities. I recommend you to take a look to the differences between Entities and Activity Entities.

Do you mean you need multiple docprojectactivities on the form where you have the activities?
You need to create a 1:n relationship between the form and the docprojectactivities and add the subgrid on that form allowing you to create multiple records for the docprojectactivities.
A lookup field is the '1' side of the 1:n relationship and thus the wrong direction.
Go to docprojectactivities, add a new field type relationship towards the entity you are working on.
Save and publish.
Now go back to the form designer of the entity you need the entries on and go to the tab 'insert'.
Click on sub-grid and select only related records docprojectactivities (entity you are working on)

If you want your custom entity to work as an activity entity, you should have selected "Define as an activity entity" when you created it.
You cannot make a normal lookup field to multiple entities (with the exception being the possibility of creating Customer fields that was introduced in 2016.1).

Related

Form based on Product Types

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.

How do we allow multiple selections for a single field in Dynamics CRM?

We needed to have multiple values selection for a custom entity Tagging. Hence, we successfully configured a many-to-many relationship between Project and Tagging entities:
However, for this entity Tagging, we're unable to select multiple values in Project form:
Any option on server side C# or js is fine.
How do we allow multiple selections for a single field in Dynamics CRM?
Not possible out of the box (or) using C# (or) using JS as many to many in the background uses a intersect table to hold data. Any related Tagging entities will therefore show up under the record's sub navigation.
Very good workaround would be to use a html web resource prompt and get the selections from the user (using a custom multi-select control) or checkboxes. You can then use CRM Actions to pass the data to a custom workflow activity which would then associate the Project with the Tagging entity.
You could also write the selected values to a new field on the form as a comma delimited text and wire up a plugin on change of the field to create/update/delete related Tagging entities.
Use Associate/Disassociate to associate projects and tagging records.

Multimple forms for one model backbone.js

The question is about managing models in forms on client with backbone.js
There is a model User on the server. It contains various fields:
Personal info
Name
Last name
Date of birth
Other info
About me (text)
My hobbies (text)
I have a single page application of settings. There are two forms on it: "personal info" form and "other info" form. I although have an api, that contains two routes to handle it - /api/user/<id>/personal_info, /api/user/<id>/other_info (it could be changed, it does not matter). I can PUT or GET info from these apis.
So I can't decide how to organize my backbone models right. Right now I have two models - UserPersonalModel and UserOtherModel, each of them has it's own api and I save them apart from each other.
Am I doing right or I shall rewrite it to one js model UserModel and call different save methods like .savePersonal and .saveOther? What is the best practice?
This question came here from ru.stackowerflow.com
Unless you're displaying multiple user forms at the same time and you'll have to do extra work mapping each other_info model with respective personal_info, I don't see any reason to combine those two as single model.
Especially since you have two endpoints, it's easier to have them as separate models, you can have separate view controlling each forms with respective models as well.
Combining the models will probably create nested attributes, then you'll have to manage that as well (Using plugins like deep model).

How do I create a one to many relationship in Parse?

I'm trying to set up relationships in parse, but I don't know how. For instance, could I get explicit instructions on how I would link the two tables below?
Branch table consist of objectId, branchName, company, address.
Company table consist of objectId, companyName.
I would like to make a relation between Branch's company field and Company's objectId field in the manner that If I were to pull a record for a specific Branch, the string in the company field would relate to the objectId in the Company table. In real terms 1 company can have multiple branch's, but a branch can only relate to one company.
I have primarily used Access and understand how to make relationships and calls there, but cant figure out how to do it in parse. Do I need to wrote code in my main.js file? Can I do this from the data tab in my dashboard on parse.com?
Relationships in Parse are handled through the Relation data type. To make a class that uses a relation, do the following:
Go into your Parse account, open the app you want to add this class to.
Click on 'Core'.
Click on "data".
Click "Add Class:
For Class #1, call it Company.
Make sure that class is highlighted on the left side, and click "Add Col": Add the companyName as a column, and choose string as the data type.
Do these same instructions again, this time for the Branch class.
Add more columns for the branch class for branchName and address. For the company name relation, do the following:
Add a new column. For the "Select a Type" dropdown, choose "Relation";
On the middle dropdown, it will ask you what you want to relate it to, tell it which Parse class (Company), and on the right, name the column (in your case, it would be "CompanyId").

Dynamics 2013: Filtered Lookup showing only related entities

In dynamics crm 2013 I want to provide paypal data for individual contacts.
I have a paypalAccount entity, which can be set in a lookup on the contact form.
Now I want to filter the lookup on the contact form, to only display paypal accounts which where ever assigned to this contact.
I do not want the user to see thousands of unrelated paypal accounts when trying to select a different one for a specific user.
You can pre-filter your lookup. There are some standard ways to do this, but you can also use FetchXml. A nice article can be found here.
You must implement a 1:N relationship between these entities. Then that entity just see related entities.

Categories