We have a custom field on our Customer form "client_type" and would like to be able to reference the same field's values on the Customer's Contacts as well on the Contact form. The data is populated for all Customers currently, though when creating the custom field on the Contact form and selecting
SOURCE LIST -> Parent & SOURCE FROM -> client_type the Contact records do not have any data populated. Tried waiting to see if this was a caching issue as we saw with another modification in NS we did recently and there was no solution.
Related
I'm trying to create a simple 2 table database - table 1 holds ClientInfo and table 2 has ClientVisits - Relationship is on ClientInfo.ID->ClientVisits.ClientID. Then I have a form created thus for viewing the ClientInfo plus a child(sub?)table which SHOULD show all the records from ClientVisits where my Form ClientID = ClientVisits.ClientID.
Here is my form
Here is the child table with fields shown
Relationships
So I already have one record in ClientVisits for the currently chosen ClientID form record. But it doesn't show in my Table.ClientVisits. Other than the relationship I don't have any other link between the ClientID and the ClientVisits.ClientID field.
If I need to post further info please let me know, trying to describe this as well as I can - sorry if it's not making sense. Thanks.
You have to link both tables in your form.
In my example, main data of my form is a table called CLIENTES, where it shows all the information about a cliente. It would be exactly the same as your table ClientDetails. In this table, primary key is a field called DNI (it would be the equivalent of your ID field)
I got a second table called CONSULTAS MÉDICAS. This table is just a list of how many times this client comes to see us. It would be the same as your secondary table CLIENT VISITS. In this table, I got a field called PACIENTE, linked to my table CLIENTES. Let me show you.
Ok, now my form is done based on the data of my table CLIENTES, but I got a subform control, where I have linked the table CONSULTAS MÉDICAS
To make this work is pretty easy. Not filters or queries. Just linked child and master fields. To do this, you have to select properties of your subform control, and then go to DATA TAB
Just choose as main field your ID field from table CLIENT DETAILS and link it to child field CLIENT ID from table CLIENT VISITS
That should work for you.
The Setup
I am working on a project using Symfony 3 and SonataAdminBundle 3.1.
I am using the nested form method of sonata admin where I have 4 entities:
Category, Product, Supplier, and Contact. They all have one-to-many relation with each other respectively.
I am using sonata_type_collection to put products in category form, and using the same to put suppliers in product form, and using the same to put contacts in the supplier form. The contact form has a sonata_type_model_list field for zipcodes.
The Problem
I am facing the following error when I click the add new contact button on the supplier form from within the category > product form.
Could not get element id from
s58c147845272f_products_2_suppliers_0_contacts Failing part: contacts
The error does not show up when I save the form step by step - like i add a product to the category form then save the form, then add a supplier to product and then save the form, and when i add the contact - the contact form is loaded and the above mentioned exception is not thrown. Also When I go directly to Supplier form and add the contact there, the exception is not thrown.
It is only when the supplier is not saved from within the category form that the above exception is thrown.
any help is highly appreciated.
Check if any of your properties have underscore in the name, like my_file. Try to change it into myFile and also accordingly change code in your Admin class:
$formMapper->add('my_file', 'file'); => $formMapper->add('myFile', 'file');.
Update:
I think I know what it is specifically - you probably have reference to your parent in your children. If that's the case, then add in your Admin classes for entities that have reference to the parents:
$formMapper->add('[parent_reference_attribute]', 'sonata_type_model_hidden');
Replacing [parent_reference_attribute] with name of your field referencing the parent.
Then exception should be gone, at least it was in my case.
I am working on Azure C# project. There is webrole with web form collecting customer’s information.
Depending on the information, they submit I need to create new custom web form for each one of them.
How can I generate new web form with custom web controls inside same site with code? I would prefer not create different site for each customer.
Any ideas appreciated!
You don't have to create a custom web form for each customer, you can have it all in on dynamic form and draw the input controls according to the customer.
You will have to have a form a form or a database table to configure the input needed for each customer which will be used in drawing the form.
ex:
You can have a table named: CustomerAttibute with the following columns
Customer ID
Attribute Name
Attribute Type (Number, text, boolean, ...)
Is Required
Validation Reg Expression
In the web form, you will read the customer ID and retrieve the attributes related to that customer, and use these attributes to draw the form, ex: an attribute of type text will be rendered as a textbox but an attribute of type boolean will be rendered as a checkbox
Capture the values from the user and insert it into another table, ex: CustomerAttributeValue which will have the attribute ID and attribute value, the value will be string to accommodate for any type
i am pushing data from SQL server using ssis into my custom entity Transaction
this transaction has a lookup filed Contact and some other simple field like email amount
i can successfully import data into the crm only when i push email id and amount ,
whenever i try to set lookup field value it require entity reference id , this is where i am stuck in our database there is no entity reference id we only have name
how can i set look up filed value if i don't have entity reference id , since it is a SQL data it has thousand of records
can i set my contact lookup filed value in crm itself based on email id like lets say i imported the data and once the data is imported into crm lookup filed value will set to that particular contact who has the email id which we imported into crm
i hope i am making myself clear please help me out
thanks
Inside your script component (I believe you use this approach) you will have to write code that will fetch required data from CRM using RetreiveMultiple queries.
The objective:
Having a many-to-many relation be displayed as a dynamic list of select inputs(single choice dropdown list)
User arrives on page with a single select field (multiple = false) populated with persisted entities and add/remove buttons. By clicking the add button, a new select field with the same options appears below the first, which adds a new entry in the M2M relation. By clicking remove the field disappears and the entry should be removed.
The model:
Two entities: User & Manager. A User has exactly one "special" Manager and unlimited normal Managers.
Managers manage unlimited users.To model this I have created two relationships for which the user is the "owner" (not sure how to translate this)
ManyToOne specialManager
ManyToMany normalManagers
I haven't created a many to many relationship with attribute "special" because the requirement is exactly one special manager and I wasn't sure if Symfony/Doctrine would cause problems down the line.
What I have:
I can display a multiple select field with the existing entities using Entity field type, as per the documentation. Functionally this is what I need, visually it is not.
I can also use the Collection field type to display a single text field, and add or remove more with JS, as per the documentation. Visually this is what I need, but The text fields (entity attribute) need to be replaced by choice field.
The question:
Before I continue digging, is there a simple way to achieve this list of select tags?
For anyone else who may eventually need a dynamic list of select fields:
I initially solved this issue by detaching the field(s) in event listeners, and handling the display/submission manually in the controller.
However I wasn't satisfied with this clunky solution and when I encountered the same need I used a second solution: creating an intermediary entity xxxChoice (in this case ManagerChoice) which is Mto1 inversed related to User and Mto1 related to Manager. Then by creating a ManagerChoiceType form with "Manager" entity field type I was able to easily display my collection of dropdown select lists.