I have a grid which users can add products too
I have a plugin that executed when there is a update to the record, however when a product is added the plugin/CRM doesn't recognise that as a update to the record therefore the plugin doesn't execute.
Is there a OnChange function I can access through JavaScript for the Grid so that I can change the value of a hidden field so that then a change has been made to the record, therefore a update being recognised and the plugin being executed?
Thanks
No, there is a no SDK function to add a JavaScript event when an item is added to a grid is CRM 2011/2013.
The correct way to handle this requirement is in a plug-in.
Records appear in a grid when they are related to the parent record - either a one-to-many relationship or as a many-to-many relationship.
If it is a one-to-many relationship you can trigger on the Create and Update of the many side (since it will contain a reference to the one side.) If it is a many-to-many you'll need to trigger on Association as shown here in a previous question.
One way to handle this situation would be add a on-create plugin for the Products - which can trigger the On Change plugin for the record in the similar fashion as you are trying to.
Essentially, oncreate plugin will update the record which will fire the on update plugin of the record. This would be the case if the relationship is 1:N
If its a N:N relationship, then the plugin should be registered on Associate / Diassociate, not on create / update.
In fact, the question is not clear, hence the two options above.
Related
After researching i am still stuck on my predicament. I am using the latest version of foundation for apps with angular 'pre-embedded'.
I have a form which is used for both adding and editing data - lets say its for a job and it tracks employees days on the job. on load of the view the form is completely empty and contains two sections - the job details and the employees details.
first the user would have to enter and save the details in the job section (in order to create the id for the job so the employees can be linked to it) for the employees section to be activated. This works fine and is enabled by the job id being set to > 0 (-1 being default on load);
This all works fine so far, but i have a function in my controller to allow loading in an existing job record. when the user blurs on one of three fields the controller checks the data object for jobs matching these unique fields and loads (angular.copy) in the data in the scopes 'job' model. When this is loaded all form inputs are set and marked as dirty.
obviously my required behavior is that if the job details are loaded in by the system the form is not marked as dirty so as to allow me to know if the job details have been edited at any point after. the same is required of a new job that has been saved and given an id.
as i understand it the setPristine() function actually resets the form and model, similar to form[0].reset() but I may be wrong. I also suspect untouched may be a way to go?
also i should mention that the contains all sections to this view including the add employee inputs in the employee section.
I understand I can simply remove the ng-dirty class manually but have read this then does not update the angular way and will not identify further edits.
Is there a way i can functionally remove the ng-dirty from all child inputs of an element and not all in the form and without removing the loaded data too?
note: all inputs by default are linked (via ng-model) to their relevant models and data is loaded in the controller to the model.
It seems I've misunderstood pristine from the other posts, after further tests it is only the field that the unique data was entered into that is changed to dirty. I simply need to call setPristine on this after loading the existing record and then maybe loop through all elements within this section to test them. $setPristine does not clear the input as i read previously.
I'm facing a issue that I need to call a javascrip function when the user select any row of a SubGrid.
Scenario:
I have two grids, the first one shows accounts records, the second one is supposed to show all the Phones related with the account record that I selected on the first grid.
Is that possible?
Thanks in Advance
CRM Javascipt SDK doesn't support any of those features. You should probably have a custom ribbon button to handle it. Or you can use jquery to attach some events on the record dom. But, this is not supported by CRM 2011.
I am using Knockout js. I have a view model that contains an array of objects and I want to allow the user to edit one of the objects using a wizard style interface. The issue I have is the wizard will show different steps depending on what choices are made. For instance:
If the user selects 'Yes' on step 1 then I display step 2a
If the user selects 'No' on step 1 then I display step 2b (ie. a different dialog form)
This goes on so that the paths through the wizard are not linear.
My question is do I bind all the possible wizard UI steps to the view model at start up even though some steps will never be shown and the bindings on some screens will be invalid (eg. step 5 may bind to viewModel.theObject.PropertyA.PropertyB.PropertyC() but PropertyB is still null at step 1).
A better way may be to bind to the UI steps as they are displayed but my problem is then there I am not aware of a good way to 'unbind' the model once the step has completed so I could end up with the step bound to multiple objects from the original list!
I think that a good way to do this is to have your view model be an array of steps and bind your UI to the "selectedStep". Then, each step can dynamically choose which template that it wants to use (like in this post).
Here is a rough sample of the idea: http://jsfiddle.net/rniemeyer/SSY6n/
This way the template bindings handles generating/binding/cleaning up the dynamic content based on whatever step is selected. If the steps are in an observableArray, then you could even dynamically add steps. Maybe you have a list of all of the possible steps and then have an "activeSteps" array that represents the steps that are currently valid based on the user's choices.
I have a gridview and a dropdownlist on my page.
The gridview is binded through code behind with some columns. Among these price is also a column.
My scenario is to change the price field based on the dropdown criteria.
The price column consists of values in "lakhs", and i need to change them as crores or usd or some other format as per dropdown.
I don't want to go for postbacks. I want these to be implemented using javascript.
(These changes are for user conversion. They need not to be saved on database)
Thanks in advance
Madhu
You have two options. If you don't want to go for any response from the server (i.e. you don't want to make an AJAX call), you could populate a hidden field with a list of comma-delimited values that correspond to your dropdown values. It's an ugly approach, but it would work.
The other option is to make an AJAX call to a web method on the server (or possibly a financial service like Yahoo! Finance). When your dropdown selected value changes, that event fires a call to the server.
If you were able to indicate what platform you're using (PHP, .Net or other), someone will likely be able to provide more relevant examples and code samples.
Since the grid is rendered as an HTML Table, you can actually manipulate anything on the client.
I would pickup jQuery for the task
We're using SmartClient GWT library (see the Smartclient GWT showcase here).
I'm trying to make a ListGrid UI that when you click a record the fields become editable. Just like the example:
Grid Editing Mass Update
The difference is I'm using my own custom GWT RPC services and manually adding ListGridRecord's to my own DataSource, and I see my records appear but the fields aren't editable when clicked. I've created a custom DataSource using the GWTRPCDataSource implementation and properly override the executeFetch method.
Is there some special processing that's going on using the examples XML DataSource that creates ListGridRecords that properly set it up to be editable?
For example I'm using the CountryXMLDS.java just like the example except I'm adding one custom record (and I've removed all fields but the population field that I want to be editable). I see my record appear but the field is NOT editable when the record is clicked.
ListGridField populationField = new ListGridField("population", "population");
populationField.setType(ListGridFieldType.INTEGER);
populationField.setCanEdit(true);
countryGrid.setFields( populationField);
countryGrid.setCanEdit(true);
countryGrid.setEditEvent(ListGridEditEvent.CLICK);
ListGridRecord record = new ListGridRecord();
record.setAttribute("population", "5");
CountryXmlDS.getInstance().addData(record);
Whatever the problem is, it's not in the details you've shared. Try these steps:
make sure you're calling setDataSource() on the ListGrid with your DataSource
make sure the name of your ListGrid field matches a field from the DataSource. This is case sensitive
make sure you have a primaryKey declared in the DataSource. There's no way to save edits unless there's a way to identify records
look for messages in the Developer Console
http://forums.smartclient.com/showthread.php?t=8159#aConsole
shotgun approach: override ListGrid.canEditCell() and return whatever you want - this overrides all the declarative settings like field.canEdit.