How to clone a record in a custom entity & the related child records on click of a custom button 'Clone Record' on the form? - dynamics-crm-2015

I am using Dynamic CRM 2015 On-Premise.
I want to clone a record in a custom entity & the related child records on click of a custom button 'Clone Record' on the form.
Please provide some example on how to clone a record in a custom entity & the related child records on click of a custom button 'Clone Record' on the form.

You can develop a Code Activity which would:
Read Parent
Read Children
Create Clone of parent, grab id
create clone of children, using the record id grabbed at #3 as parent
No need to get much fancy, just go through the steps sequentially.
To fire the code, you can create an Action (which would be invoked by the ribbon) containing the aforementioned Code Activity

Related

mark complete from another context

I have an Account form.
In the interactions tab I have the sub grid for meetings.
I have added the new button to this Sub-grid, 'Complete the Meeting'.
I want to trigger the 'Mark Complete' button of the Meeting form from here.
How can I do it ?
My first choice would be using Activities subgrid instead of Appointments. I just verfied as below.
If that wont work for you for any reasons, then custom ribbon button is a good choice. You have to customize the command of your custom button to use javascript command, then pass the selected IDs from subgrid to ribbon button command and iterate the IDs for updating Appointment records using Xrm.Webapi in javascript function.

How to show and change the state in tree view

I want to show the state change field in tree view. Usually we did this in form view. For example in form view state can be changed from draft to done. I need like this type of state change in tree view also. can you give a solution to do this?
You can do it via Wizard process, In More/Action option you can create new wizard for update state.
Ex :
class test(models.TransientModel):
_name="update.state"
state=fields.Selection([('draft','draft'),('done','done')])
#api.multi
def **update_state_ept**(self)
active_ids=self._context.get(active_ids)
records=self.env[model].search(active_ids).write({'state':self.state})
You can select records from tree view and open wizard from More/Action Menu,select state & update it.
Above example is just an update state, you can put different conditions based on your requirement.
Ex: If record is draft then we can confirm it.
You can create following answer for create new wizard in more/action menu item.
How do i make and attache action to button
This may help you.

Dynamics CRM sub grid defaulting to creating new record vs. lookup existing records

We are using Dynamics CRM 2016. I am using the Account entity to track both customers and competitors. I created a new 1:N relationship between Opportunity and Account and named it Account_Competitors. I put a sub grid on my opportunity form titled "Competitors" and configured it to show related Account_Competitors. When I click the "+" button I get a quick create form. I want the "Add Existing" behavior. How do I fix this?
If the lookup to Opportunity on Account is business required, you will experience what you see now (which does not sound optimal).
If you change the lookup to be optional instead, the initial behavior when pressing the "+" button in a subgrid will be to initiate the "Add Existing" behavior.
With that said, it sounds a bit strange to have a 1:N-relationship for this. In this way a Competitor-Account can only be associated with a single Opportunity. I would suggest looking into using the standard Competitor entity, or using an N:N relationship instead.
To control the behavior of the new record button on subgrids, look at the child entity being selected in the subgrid..If the lookup field for the parent is required, the user will get a “new record” form when clicking the + button. If the lookup field for the parent entity is not required on the child entity, the user will get the lookup field to “add existing.”
For more details with example you can look at http://www.inogic.com/blog/2014/05/sub-grid-add-action-behavior-in-dynamics-crm/

Adempiere - How to design/call CreateLinesFrom button in window

I want to create CreateLineFrom form in my custom window/Table in WEBUI.
I have created CreateFrom field in my custom table and window level.
So is there any java code changes needed ?
Its already exists in Material Receipt standard window, now i want to do same thing in my custom window, so where i have to modify.
Write a process - there are lots of examples in the the org.compiere.process of the "base" module.
Create a new Process in the Application Dictionary and point it to your newly written process created in step 1.
Add a new column of reference type button to the table underlying the Window/Tab you'd like the button on and point this your new process by selecting the Process from the drop-down.
Finally add the new column created to the Windows/Tab were you need it to appear.

How to apply filter/specific criteria for browser UI component in Exact Synergy Enterprise?

I am creating a maintenance page where I want to select a task using browser UI component. What I want to do specifically is to filter and show only tasks that are not done yet. Can I implement this using browser UI component? Does Exact Synergy Enterprise offer other components for this functionality?
You should create your browser Repository Explorer and use it in browsefield UI component.
Go to System tab, process to Setup tab and under the Repository section click Explorer. Locate your Repository group, enter it, click Browsers tab next to Business components, Functional components, etc.
Click Add and provide Name, Caption, Caption suffix fields. Then write your SQL query in Query field. The structure is:
SELECT <column(s)> FROM <database table> WHERE <column(s)> IS NOT NULL ORDER BY <column>.
Leave the Column info field empty for now. Fill in the Result columns field with column name which will be used as a Browser component result.
Finally, add database table name in the Table list field. Click Save + Edit column info button. Edit column names from a list shown below Information section and fill in Header/Term ID field with title, describing your columns (this will be shown in Browser UI for the front-end user). Click Save and test your newly created browser. If something went wrong, repeat steps from the start. Most of the time problem could be wrongly filled Column info field.
Now go to your ASPX page and add browsername attribute to your browsefield UI component. Doing so will set the browserfield component to your newly created browser component. This is that you want to see in your maintenance page when setting up the browsefield UI component:
<ex:cardfield runat="server" id="cf" caption="Item" captionid="0">
<ex:browsefield runat="server" id="p" browsername="pbr" datasource="bc" />
</ex:cardfield>
Hope this gives you quick idea of what you need to do in order to adjust it to your situation with tasks.

Resources